From: Jonathan Rose Date: Mon, 22 Oct 2012 19:56:20 +0000 (+0000) Subject: core: Fix a memory leak in app.c from an early return X-Git-Tag: 10.11.0-rc1~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=33f58fe247f1bc698abb0aabbb5c80b072cdf132;p=thirdparty%2Fasterisk.git core: Fix a memory leak in app.c from an early return ast_app_group_match_get_count allocates memory with the regcomp function and we previously forgot to free it when bailing out due to a regex compilation failure against category. (closes issue AST-1018) Reported by: Guenther Kelleter Patches: regcomp_memleak.diff uploaded by Guenther Kelleter (license 6372) ........ Merged revisions 375299 from http://svn.asterisk.org/svn/asterisk/branches/1.8 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/10@375300 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/app.c b/main/app.c index 6e187a1090..93e8aa8702 100644 --- a/main/app.c +++ b/main/app.c @@ -1183,6 +1183,7 @@ int ast_app_group_match_get_count(const char *groupmatch, const char *category) if (!ast_strlen_zero(category) && regcomp(®exbuf_category, category, REG_EXTENDED | REG_NOSUB)) { ast_log(LOG_ERROR, "Regex compile failed on: %s\n", category); + regfree(®exbuf_group); return 0; }