]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
core: Fix a memory leak in app.c from an early return
authorMatthew Jordan <mjordan@digium.com>
Fri, 2 Nov 2012 17:38:50 +0000 (17:38 +0000)
committerMatthew Jordan <mjordan@digium.com>
Fri, 2 Nov 2012 17:38:50 +0000 (17:38 +0000)
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/certified/branches/1.8.15@375615 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/app.c

index 70d804d4fcc85c7599cade63cced594a187f1b10..b429661bec69b59cbf8f76e231d28bb0880f8ddd 100644 (file)
@@ -1441,6 +1441,7 @@ int ast_app_group_match_get_count(const char *groupmatch, const char *category)
 
        if (!ast_strlen_zero(category) && regcomp(&regexbuf_category, category, REG_EXTENDED | REG_NOSUB)) {
                ast_log(LOG_ERROR, "Regex compile failed on: %s\n", category);
+               regfree(&regexbuf_group);
                return 0;
        }