瀏覽代碼

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 年之前
父節點
當前提交
61f4d7f127
共有 1 個文件被更改,包括 2 次插入1 次删除
  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;
 }