Module: sems
Branch: master
Commit: 5ba0e9369488a6ed5ff58bc5be7f2685352819ce
URL:    
http://git.sip-router.org/cgi-bin/gitweb.cgi/sems/?a=commit;h=5ba0e9369488a6ed5ff58bc5be7f2685352819ce

Author: Raphael Coeffic <[email protected]>
Committer: Raphael Coeffic <[email protected]>
Date:   Wed Apr  4 12:10:51 2012 +0200

b/f: fix double free issue introduced in 17547b67ff6

while copying the dns handle, the reference counting was left out, causing a 
double free when the transaction gets deleted (all timers have expired).

---

 core/sip/resolver.cpp |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/core/sip/resolver.cpp b/core/sip/resolver.cpp
index 51392de..87da89b 100644
--- a/core/sip/resolver.cpp
+++ b/core/sip/resolver.cpp
@@ -498,6 +498,19 @@ int dns_handle::next_ip(sockaddr_storage* sa)
        return ip_e->next_ip(this,sa);
 }
 
+const dns_handle& dns_handle::operator = (const dns_handle& rh)
+{
+    memcpy(this,(const void*)&rh,sizeof(dns_handle));
+    
+    if(srv_e)
+       inc_ref(srv_e);
+    
+    if(ip_e)
+       inc_ref(ip_e);
+    
+    return *this;
+}
+
 
 _resolver::_resolver()
     : cache(DNS_CACHE_SIZE)

_______________________________________________
Semsdev mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/semsdev

Reply via email to