[Home]

Summary:ASTERISK-04186: memory leak in chan_sip/mysqlsipfriends
Reporter:Roy Sigurd Karlsbakk (rkarlsba)Labels:
Date Opened:2005-05-16 09:27:57Date Closed:2011-06-07 14:10:31
Priority:MinorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:( 0) leak.patch
Description:hi

there is a leak in chan_sip with mysqlsipfriends and/or mysqlsipusers enabled.
astmm reports the malloc at
      828 bytes allocated in           mysql_user at line  1136 of chan_sip.c
is called over and over again, once each call. I beleive the attached patch solves the problem.

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

Index: channels/chan_sip.c
===================================================================
RCS file: /var/lib/cvs/asterisk/channels/chan_sip.c,v
retrieving revision 1.2
diff -u -r1.2 chan_sip.c
--- channels/chan_sip.c 7 Mar 2005 10:48:13 -0000       1.2
+++ channels/chan_sip.c 16 May 2005 14:26:15 -0000
@@ -1763,6 +1763,10 @@
                       ast_log(LOG_ERROR, "update_user_counter(%s,%d) called with no event!\n",u->name,event);
       }
       ast_mutex_unlock(&userl.lock);
+#ifdef MYSQL_USERS
+       if (u)
+               free(u);
+#endif
       return 0;
}

Comments:By: Clod Patry (junky) 2005-05-16 09:48:56

Could you attach patch instead of pasting code? Like said in the bug guidelines.

By: Roy Sigurd Karlsbakk (rkarlsba) 2005-05-16 09:58:32

I thought perhaps it'd be ok to paste a four-line patch, but ok, the file's there for you



By: Russell Bryant (russell) 2005-05-16 13:50:47

committed a slighty modified fix, Thanks!

By: Digium Subversion (svnbot) 2008-01-15 15:35:07.000-0600

Repository: asterisk
Revision: 5703

U   branches/v1-0/channels/chan_sip.c

------------------------------------------------------------------------
r5703 | russell | 2008-01-15 15:35:06 -0600 (Tue, 15 Jan 2008) | 2 lines

fix mem leak with MYSQL_USERS (bug ASTERISK-4186)

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

http://svn.digium.com/view/asterisk?view=rev&revision=5703