Browse code

fixes SER-345 - patch accepted

Michal Matyska authored on 07/01/2008 12:45:30
Showing 3 changed files
... ...
@@ -165,6 +165,12 @@ int parse_select (char** p, select_t** s)
165 165
 	return 0;
166 166
 }
167 167
 
168
+void free_select(select_t *s)
169
+{
170
+	if (s)
171
+		pkg_free(s);
172
+}
173
+
168 174
 int shm_parse_select (char** p, select_t** s)
169 175
 {
170 176
 	select_t* sel;
... ...
@@ -120,7 +120,9 @@ typedef int (*select_f)(str* res, struct select* s, struct sip_msg* msg);
120 120
 typedef struct select {
121 121
 	select_f f[MAX_NESTED_CALLS];
122 122
 	int param_offset[MAX_NESTED_CALLS+1];
123
+	/* contains broken down select string (@foo.bar[-2].foo -> 4 entries) */
123 124
 	select_param_t params[MAX_SELECT_PARAMS];
125
+	/* how many elements are used in 'params' */
124 126
 	int n;
125 127
 } select_t;
126 128
 
... ...
@@ -175,6 +177,10 @@ int register_select_table(select_row_t *table);
175 175
  */
176 176
 int parse_select (char** p, select_t** s);
177 177
 
178
+/**
179
+ * Frees the select obtained with parse_select().
180
+ */
181
+void free_select(select_t *s);
178 182
 /*
179 183
  * Select parser, result is stored in SHARED memory
180 184
  * 
... ...
@@ -68,7 +68,7 @@ static int active_buffer=-1;
68 68
 
69 69
 #define ALLOC_SIZE(req_size) (((req_size/BUFFER_GRANULARITY)+1)*BUFFER_GRANULARITY)
70 70
 
71
-int allocate_buffer(int req_size) {
71
+static int allocate_buffer(int req_size) {
72 72
 	void *b;
73 73
 	int size=ALLOC_SIZE(req_size);
74 74