From f57025fa90431ae080a91d54ae92564b919da52f Mon Sep 17 00:00:00 2001 From: Liviu Chircu Date: Tue, 19 Aug 2014 14:50:24 +0300 Subject: [PATCH] dialplan: fix shm leak when parsing invalid regex Upon (re)load, if the subst or repl columns contain expressions which fail to compile, OpenSIPS will leak shared memory. Reported by miko95 on GitHub Closes issue #307 (cherry picked from commit 72028d26bef361b6c99f6ad3653f0e1dbb07c767) --- modules/dialplan/dp_db.c | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/dialplan/dp_db.c b/modules/dialplan/dp_db.c index 0e5f0b361b..a2161f5603 100644 --- a/modules/dialplan/dp_db.c +++ b/modules/dialplan/dp_db.c @@ -435,6 +435,7 @@ dpl_node_t * build_rule(db_val_t * values) return new_rule; err: + if(match_comp) wrap_pcre_free(match_comp); if(subst_comp) wrap_pcre_free(subst_comp); if(repl_comp) repl_expr_free(repl_comp); if(new_rule) destroy_rule(new_rule);