[asterisk-commits] dvossel: trunk r281433 - in /trunk: ./ channels/chan_sip.c

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


Author: dvossel
Date: Mon Aug  9 15:49:13 2010
New Revision: 281433

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=281433
Log:
Merged revisions 281432 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

................
  r281432 | dvossel | 2010-08-09 15:47:53 -0500 (Mon, 09 Aug 2010) | 20 lines
  
  Merged revisions 281430 via svnmerge from 
  https://origsvn.digium.com/svn/asterisk/branches/1.6.2
  
  ........
    r281430 | dvossel | 2010-08-09 15:46:50 -0500 (Mon, 09 Aug 2010) | 13 lines
    
    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:
    trunk/   (props changed)
    trunk/channels/chan_sip.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: trunk/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/chan_sip.c?view=diff&rev=281433&r1=281432&r2=281433
==============================================================================
--- trunk/channels/chan_sip.c (original)
+++ trunk/channels/chan_sip.c Mon Aug  9 15:49:13 2010
@@ -12655,7 +12655,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);
@@ -12683,6 +12682,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