[Home]

Summary:ASTERISK-10682: [patch] chan_unistm.c Memory leak & Deadlock & Crash
Reporter:Eliel Sardanons (eliel)Labels:
Date Opened:2007-11-04 22:29:21.000-0600Date Closed:2007-11-05 07:09:45.000-0600
Priority:CriticalRegression?No
Status:Closed/CompleteComponents:Channels/chan_unistim
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) chan_unistim.c.patch
Description:I have found some memory leaks and possible deadlocks on chan_unistm.c. Also fixed a crash and changed free() to ast_free().


-- We also need to added Channels/chan_unistm to the mantis categories --

****** ADDITIONAL INFORMATION ******

Memory leaks:
        - need to free cfg while returning in the middle of the load_config.
        - need to free allocated buffers if one of them is not correctly allocated.
                a = ast_malloc();
                if (!a) return -1;
                b = ast_malloc(); if (!b) ast_free(a); return -1;
Deadlock:
         - need to unlock devicelock while returning because of an error in the middle of the "work";
Crash:
         - If module chan_unistm.so is loaded and no configuration file is found, we can run "module reload chan_unistm.so" and asterisk will crash.
              This is because io=null and ast_wait_io() does not check this condition, so 'io' must never be null. (That is why a LOAD_FAILURE should be returned and no a simple DECLINE).
         - Added some checks to "unistm sp" cli command handler (passing no params asterisk crash).
         - Added some checks to "unistm reload" cli command handler (passing e=null and a=null makes asterisk to crash).
         - I also added to 'return NULL' to function unistim_new() cause if sub == null sub->* will make asterisk to crash, and if 'sub->parent' is null too.

Comments:By: Eliel Sardanons (eliel) 2007-11-04 22:36:54.000-0600

Sorry for creating this issue report in this category, fill free to move this issue to the missing (Channels/chan_unistim) category.

By: Digium Subversion (svnbot) 2007-11-05 07:09:44.000-0600

Repository: asterisk
Revision: 88510

U   trunk/channels/chan_unistim.c

------------------------------------------------------------------------
r88510 | file | 2007-11-05 07:09:44 -0600 (Mon, 05 Nov 2007) | 6 lines

Fix memory leaks and deadlocks in chan_unistim.
(closes issue ASTERISK-10682)
Reported by: eliel
Patches:
     chan_unistim.c.patch uploaded by eliel (license 64)

------------------------------------------------------------------------