[asterisk-commits] dvossel: branch 1.6.2 r281430 - /branches/1.6.2/channels/chan_sip.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Aug 9 15:46:55 CDT 2010


Author: dvossel
Date: Mon Aug  9 15:46:50 2010
New Revision: 281430

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=281430
Log:
fixes SIP peers memory leak

We zeroed out the peer's addr before it was removed from the
peers_by_ip container.  This made it impossible to be removed
from the container as the addr is the key used by the container
to find the peer.

(closes issue #17774)
Reported by: kkm
Patches:
      017774-sip-peer-leak-1.6.2.10.diff uploaded by kkm (license 888)
      017774-sip-peer-leak-1.8.diff uploaded by kkm (license 888)

Modified:
    branches/1.6.2/channels/chan_sip.c

Modified: branches/1.6.2/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.6.2/channels/chan_sip.c?view=diff&rev=281430&r1=281429&r2=281430
==============================================================================
--- branches/1.6.2/channels/chan_sip.c (original)
+++ branches/1.6.2/channels/chan_sip.c Mon Aug  9 15:46:50 2010
@@ -12114,7 +12114,6 @@
 
 	peer->expire = -1;
 	peer->portinuri = 0;
-	memset(&peer->addr, 0, sizeof(peer->addr));
 
 	destroy_association(peer);	/* remove registration data from storage */
 	set_socket_transport(&peer->socket, peer->default_outbound_transport);
@@ -12141,6 +12140,10 @@
 			ao2_t_unlink(peers_by_ip, peer, "ao2_unlink of peer from peers_by_ip table");
 		}
 	}
+
+	/* Only clear the addr after we check for destruction.  The addr must remain
+	 * in order to unlink from the peers_by_ip container correctly */
+	memset(&peer->addr, 0, sizeof(peer->addr));
 
 	unref_peer(peer, "removing peer ref for expire_register");
 




More information about the asterisk-commits mailing list