Explorar el Código

fixes SER-345 - patch accepted

Michal Matyska hace 17 años
padre
commit
2a062f98d3
Se han modificado 3 ficheros con 13 adiciones y 1 borrados
  1. 6 0
      select.c
  2. 6 0
      select.h
  3. 1 1
      select_buf.c

+ 6 - 0
select.c

@@ -165,6 +165,12 @@ int parse_select (char** p, select_t** s)
 	return 0;
 }
 
+void free_select(select_t *s)
+{
+	if (s)
+		pkg_free(s);
+}
+
 int shm_parse_select (char** p, select_t** s)
 {
 	select_t* sel;

+ 6 - 0
select.h

@@ -120,7 +120,9 @@ typedef int (*select_f)(str* res, struct select* s, struct sip_msg* msg);
 typedef struct select {
 	select_f f[MAX_NESTED_CALLS];
 	int param_offset[MAX_NESTED_CALLS+1];
+	/* contains broken down select string (@foo.bar[-2].foo -> 4 entries) */
 	select_param_t params[MAX_SELECT_PARAMS];
+	/* how many elements are used in 'params' */
 	int n;
 } select_t;
 
@@ -175,6 +177,10 @@ int register_select_table(select_row_t *table);
  */
 int parse_select (char** p, select_t** s);
 
+/**
+ * Frees the select obtained with parse_select().
+ */
+void free_select(select_t *s);
 /*
  * Select parser, result is stored in SHARED memory
  * 

+ 1 - 1
select_buf.c

@@ -68,7 +68,7 @@ static int active_buffer=-1;
 
 #define ALLOC_SIZE(req_size) (((req_size/BUFFER_GRANULARITY)+1)*BUFFER_GRANULARITY)
 
-int allocate_buffer(int req_size) {
+static int allocate_buffer(int req_size) {
 	void *b;
 	int size=ALLOC_SIZE(req_size);