[asterisk-commits] jrose: branch 12 r401831 - in /branches/12: ./ main/utils.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 24 15:34:25 CDT 2013
Author: jrose
Date: Thu Oct 24 15:34:23 2013
New Revision: 401831
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=401831
Log:
utils: Fix memory leaks and missed unregistration of CLI commands on shutdown
Final set of patches in a series of memory leak/cleanup patches by Corey Farrell
(closes issue ASTERISK-22467)
Reported by: Corey Farrell
Patches:
main-utils-1.8.patch uploaded by coreyfarrell (license 5909)
main-utils-11.patch uploaded by coreyfarrell (license 5909)
main-utils-12up.patch uploaded by coreyfarrell (license 5909)
........
Merged revisions 401829 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 401830 from http://svn.asterisk.org/svn/asterisk/branches/11
Modified:
branches/12/ (props changed)
branches/12/main/utils.c
Propchange: branches/12/
------------------------------------------------------------------------------
Binary property 'branch-11-merged' - no diff available.
Modified: branches/12/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/branches/12/main/utils.c?view=diff&rev=401831&r1=401830&r2=401831
==============================================================================
--- branches/12/main/utils.c (original)
+++ branches/12/main/utils.c Thu Oct 24 15:34:23 2013
@@ -2277,6 +2277,15 @@
return safe_mkdir(absolute_base_path, p, mode);
}
+static void utils_shutdown(void)
+{
+ close(dev_urandom_fd);
+ dev_urandom_fd = -1;
+#if defined(DEBUG_THREADS) && !defined(LOW_MEMORY)
+ ast_cli_unregister_multiple(utils_cli, ARRAY_LEN(utils_cli));
+#endif
+}
+
int ast_utils_init(void)
{
dev_urandom_fd = open("/dev/urandom", O_RDONLY);
@@ -2286,6 +2295,7 @@
ast_cli_register_multiple(utils_cli, ARRAY_LEN(utils_cli));
#endif
#endif
+ ast_register_atexit(utils_shutdown);
return 0;
}
More information about the asterisk-commits
mailing list