Sfoglia il codice sorgente

- avoid compiler warning
- don't free str in fixup call to select_anyheader
- xlog knows how to parse and call select, just use %@select[1]

Michal Matyska 19 anni fa
parent
commit
5823b2f79b
2 ha cambiato i file con 8 aggiunte e 1 eliminazioni
  1. 3 0
      select.c
  2. 5 1
      select_core.c

+ 3 - 0
select.c

@@ -65,6 +65,9 @@ int resolve_select(select_t* s)
 		case SEL_PARAM_INT:
 			DBG("resolve_select: [%d]\n", s->params[param_idx].v.i);
 			break;
+		case SEL_PARAM_DIV:
+			/* just to avoid the warning */
+			break;
 		}
 		for (t=select_list; t; t=t->next) {
 			table_idx = 0;	

+ 5 - 1
select_core.c

@@ -485,7 +485,11 @@ int select_anyheader(str* res, select_t* s, struct sip_msg* msg)
 			s->params[1].v.s.s[s->params[1].v.s.len]=c;
 			
 			if (hdr.type!=HDR_OTHER_T && hdr.type!=HDR_ERROR_T) {
-				pkg_free(s->params[1].v.s.s);
+				/* pkg_free(s->params[1].v.s.s); */
+				/* don't free it (the mem can leak only once at startup)
+				 * the parsed string can live inside larger string block
+				 * e.g. when xlog's select is parsed
+				 */
 				s->params[1].type = SEL_PARAM_DIV;
 				s->params[1].v.i = hdr.type;
 			}