Browse Source

modules_k/regex Fixed a memory leak when using pcre regex

The compiled regular expression when using pcre_match was not freed.
Marius Zbihlei 15 years ago
parent
commit
61f4d7f127
1 changed files with 2 additions and 1 deletions
  1. 2 1
      modules_k/regex/regex_mod.c

+ 2 - 1
modules_k/regex/regex_mod.c

@@ -575,9 +575,10 @@ static int w_pcre_match(struct sip_msg* _msg, char* _s1, char* _s2)
 				LM_DBG("matching error '%d'\n", pcre_rc);
 				break;
 		}
+		pcre_free(pcre_re);
 		return -1;
 	}
-
+	pcre_free(pcre_re);
 	LM_DBG("'%s' matches '%s'\n", string.s, regex.s);
 	return 1;
 }