[sr-dev] git:master:379667e8: regex: reset pointer after free to avoid double free if an error occurs

Daniel-Constantin Mierla miconda at gmail.com
Thu May 14 13:53:00 CEST 2015


Module: kamailio
Branch: master
Commit: 379667e878c9e0795998f600edbcbb3974846f71
URL: https://github.com/kamailio/kamailio/commit/379667e878c9e0795998f600edbcbb3974846f71

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-05-14T13:01:18+02:00

regex: reset pointer after free to avoid double free if an error occurs

---

Modified: modules/regex/regex_mod.c

---

Diff:  https://github.com/kamailio/kamailio/commit/379667e878c9e0795998f600edbcbb3974846f71.diff
Patch: https://github.com/kamailio/kamailio/commit/379667e878c9e0795998f600edbcbb3974846f71.patch

---

diff --git a/modules/regex/regex_mod.c b/modules/regex/regex_mod.c
index 35eeca0..394a9e7 100644
--- a/modules/regex/regex_mod.c
+++ b/modules/regex/regex_mod.c
@@ -411,6 +411,7 @@ static int load_pcres(int action)
 		memcpy(pcres_tmp[i], pcre_tmp, pcre_size);
 		pcre_free(pcre_tmp);
 		pkg_free(patterns[i]);
+		patterns[i] = NULL;
 	}
 	
 	/* Copy to shared memory */




More information about the sr-dev mailing list