[sr-dev] git:4.2:b103dff8: regex: reset pointer after free to avoid double free if an error occurs

Daniel-Constantin Mierla miconda at gmail.com
Tue May 19 09:32:25 CEST 2015


Module: kamailio
Branch: 4.2
Commit: b103dff88f4ac83acf20798c06d43b2586810a36
URL: https://github.com/kamailio/kamailio/commit/b103dff88f4ac83acf20798c06d43b2586810a36

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-05-19T09:29:25+02:00

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

(cherry picked from commit 379667e878c9e0795998f600edbcbb3974846f71)

---

Modified: modules/regex/regex_mod.c

---

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

---

diff --git a/modules/regex/regex_mod.c b/modules/regex/regex_mod.c
index 59cd566..5b8b5cc 100644
--- a/modules/regex/regex_mod.c
+++ b/modules/regex/regex_mod.c
@@ -418,6 +418,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