[sr-dev] git:master: modules_k/regex Fixed a memory leak when using pcre regex

Marius Zbihlei marius.zbihlei at 1and1.ro
Thu Sep 23 09:40:53 CEST 2010


Module: sip-router
Branch: master
Commit: d1d17a9c02ed4ff7d69024d4eb92369da66c3e20
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=d1d17a9c02ed4ff7d69024d4eb92369da66c3e20

Author: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Committer: Marius Zbihlei <marius.zbihlei at 1and1.ro>
Date:   Wed Sep 22 18:35:37 2010 +0300

modules_k/regex Fixed a memory leak when using pcre regex

The compiled regular expression when using pcre_match was not freed.
(cherry picked from commit 61f4d7f12723c4a3d989d37a414433e5ed71abff)

---

 modules_k/regex/regex_mod.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/modules_k/regex/regex_mod.c b/modules_k/regex/regex_mod.c
index fcefa51..3610646 100644
--- a/modules_k/regex/regex_mod.c
+++ b/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;
 }




More information about the sr-dev mailing list