2
0
Эх сурвалжийг харах

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 жил өмнө
parent
commit
61f4d7f127

+ 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);
 				LM_DBG("matching error '%d'\n", pcre_rc);
 				break;
 				break;
 		}
 		}
+		pcre_free(pcre_re);
 		return -1;
 		return -1;
 	}
 	}
-
+	pcre_free(pcre_re);
 	LM_DBG("'%s' matches '%s'\n", string.s, regex.s);
 	LM_DBG("'%s' matches '%s'\n", string.s, regex.s);
 	return 1;
 	return 1;
 }
 }