summaryrefslogtreecommitdiff
path: root/main/config.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-04-26 21:34:16 +0000
committerMatthew Jordan <mjordan@digium.com>2013-04-26 21:34:16 +0000
commit2d1cbb43114b24ffa3d3367f3dee3b8e5301d6f1 (patch)
tree56ee90abe13dc6a0d636cad16236faa68ac22d2d /main/config.c
parent562d0b4d186bc1ae8d5f0c9de5019acdef2c8575 (diff)
Clean up memory leak in config file on off nominal paths when glob is allowed
If a system allows for its usage, Asterisk will use glob to help parse Asterisk .conf files. The config file loading routine was leaking the memory allocated by the glob() routine when the config file was in an unmodified or invalid state. This patch properly calls globfree in those off nominal paths. (closes issue ASTERISK-21412) Reported by: Corey Farrell patches: config_glob_leak.patch uploaded by Corey Farrell (license 5909) ........ Merged revisions 386672 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 386677 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@386685 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/config.c')
-rw-r--r--main/config.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/main/config.c b/main/config.c
index cf2b84c72..e1c40644e 100644
--- a/main/config.c
+++ b/main/config.c
@@ -1617,6 +1617,9 @@ static struct ast_config *config_text_file_load(const char *database, const char
AST_LIST_UNLOCK(&cfmtime_head);
ast_free(comment_buffer);
ast_free(lline_buffer);
+#ifdef AST_INCLUDE_GLOB
+ globfree(&globbuf);
+#endif
return CONFIG_STATUS_FILEUNCHANGED;
}
}
@@ -1627,6 +1630,9 @@ static struct ast_config *config_text_file_load(const char *database, const char
if (cfg == NULL) {
ast_free(comment_buffer);
ast_free(lline_buffer);
+#ifdef AST_INCLUDE_GLOB
+ globfree(&globbuf);
+#endif
return NULL;
}