Skip to content

Commit

Permalink
dialplan: fix shm leak when parsing invalid regex
Browse files Browse the repository at this point in the history
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 72028d2)
  • Loading branch information
liviuchircu committed Aug 19, 2014
1 parent 632d286 commit f57025f
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions modules/dialplan/dp_db.c
Expand Up @@ -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);
Expand Down

0 comments on commit f57025f

Please sign in to comment.