[asterisk-commits] mjordan: branch 1.8 r386672 - /branches/1.8/main/config.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 26 16:26:43 CDT 2013


Author: mjordan
Date: Fri Apr 26 16:26:39 2013
New Revision: 386672

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=386672
Log:
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)


Modified:
    branches/1.8/main/config.c

Modified: branches/1.8/main/config.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8/main/config.c?view=diff&rev=386672&r1=386671&r2=386672
==============================================================================
--- branches/1.8/main/config.c (original)
+++ branches/1.8/main/config.c Fri Apr 26 16:26:39 2013
@@ -1493,6 +1493,9 @@
 				AST_LIST_UNLOCK(&cfmtime_head);
 				ast_free(comment_buffer);
 				ast_free(lline_buffer);
+#ifdef AST_INCLUDE_GLOB
+				globfree(&globbuf);
+#endif
 				return CONFIG_STATUS_FILEUNCHANGED;
 			}
 		}
@@ -1503,6 +1506,9 @@
 		if (cfg == NULL) {
 			ast_free(comment_buffer);
 			ast_free(lline_buffer);
+#ifdef AST_INCLUDE_GLOB
+				globfree(&globbuf);
+#endif
 			return NULL;
 		}
 




More information about the asterisk-commits mailing list