Merged revisions 183559 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Fri, 20 Mar 2009 17:00:58 +0000 (17:00 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 20 Mar 2009 17:00:58 +0000 (17:00 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r183559 | russell | 2009-03-20 11:53:25 -0500 (Fri, 20 Mar 2009) | 2 lines

Fix a crash in IAX2 registration handling found during load testing with dvossel.

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@183560 65c4cc65-6c06-0410-ace0-fbb531ad65f3

channels/chan_iax2.c

index bda25b2..b2559a0 100644 (file)
@@ -6682,15 +6682,20 @@ static int register_verify(int callno, struct sockaddr_in *sin, struct iax_ies *
        ast_devstate_changed(AST_DEVICE_UNKNOWN, "IAX2/%s", p->name); /* Activate notification */
 
 return_unref:
-       ast_string_field_set(iaxs[callno], peer, peer);
-       /* Choose lowest expiry number */
-       if (expire && (expire < iaxs[callno]->expiry)) 
-               iaxs[callno]->expiry = expire;
+       if (iaxs[callno]) {
+               ast_string_field_set(iaxs[callno], peer, peer);
+
+               /* Choose lowest expiry number */
+               if (expire && (expire < iaxs[callno]->expiry)) {
+                       iaxs[callno]->expiry = expire;
+               }
+       }
 
        res = 0;
 
-       if (p)
+       if (p) {
                peer_unref(p);
+       }
 
        return res;
 }