[asterisk-commits] file: trunk r81440 - in /trunk: ./ channels/chan_iax2.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Sep 4 09:25:22 CDT 2007
Author: file
Date: Tue Sep 4 09:25:21 2007
New Revision: 81440
URL: http://svn.digium.com/view/asterisk?view=rev&rev=81440
Log:
Merged revisions 81439 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r81439 | file | 2007-09-04 11:23:18 -0300 (Tue, 04 Sep 2007) | 6 lines
(closes issue #10632)
Reported by: jamesgolovich
Patches:
asterisk-iaxfirmwareleak.diff.txt uploaded by jamesgolovich (license 176)
Fix memory leak when unloading chan_iax2. The firmware files were not being freed.
........
Modified:
trunk/ (props changed)
trunk/channels/chan_iax2.c
Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.4-merged' - no diff available.
Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=81440&r1=81439&r2=81440
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Tue Sep 4 09:25:21 2007
@@ -1886,7 +1886,7 @@
}
-static void reload_firmware(void)
+static void reload_firmware(int unload)
{
struct iax_firmware *cur = NULL;
DIR *fwd;
@@ -1900,20 +1900,22 @@
cur->dead = 1;
/* Now that we have marked them dead... load new ones */
- snprintf(dir, sizeof(dir), "%s/firmware/iax", (char *)ast_config_AST_DATA_DIR);
- fwd = opendir(dir);
- if (fwd) {
- while((de = readdir(fwd))) {
- if (de->d_name[0] != '.') {
- snprintf(fn, sizeof(fn), "%s/%s", dir, de->d_name);
- if (!try_firmware(fn)) {
- ast_verb(2, "Loaded firmware '%s'\n", de->d_name);
+ if (!unload) {
+ snprintf(dir, sizeof(dir), "%s/firmware/iax", (char *)ast_config_AST_DATA_DIR);
+ fwd = opendir(dir);
+ if (fwd) {
+ while((de = readdir(fwd))) {
+ if (de->d_name[0] != '.') {
+ snprintf(fn, sizeof(fn), "%s/%s", dir, de->d_name);
+ if (!try_firmware(fn)) {
+ ast_verb(2, "Loaded firmware '%s'\n", de->d_name);
+ }
}
}
- }
- closedir(fwd);
- } else
- ast_log(LOG_WARNING, "Error opening firmware directory '%s': %s\n", dir, strerror(errno));
+ closedir(fwd);
+ } else
+ ast_log(LOG_WARNING, "Error opening firmware directory '%s': %s\n", dir, strerror(errno));
+ }
/* Clean up leftovers */
AST_LIST_TRAVERSE_SAFE_BEGIN(&firmwares, cur, list) {
@@ -10382,7 +10384,7 @@
ao2_callback(peers, 0, iax2_poke_peer_cb, NULL);
}
- reload_firmware();
+ reload_firmware(0);
iax_provision_reload(1);
return 0;
@@ -11187,6 +11189,7 @@
delete_users();
iax_provision_unload();
sched_context_destroy(sched);
+ reload_firmware(1);
for (x = 0; x < IAX_MAX_CALLS; x++)
ast_mutex_destroy(&iaxsl[x]);
@@ -11317,7 +11320,7 @@
ao2_callback(peers, 0, iax2_poke_peer_cb, NULL);
- reload_firmware();
+ reload_firmware(0);
iax_provision_reload(0);
return AST_MODULE_LOAD_SUCCESS;
More information about the asterisk-commits
mailing list