[asterisk-commits] branch 1.2 r16771 - /branches/1.2/channels/chan_iax2.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Fri Mar 31 12:11:28 MST 2006


Author: russell
Date: Fri Mar 31 13:11:26 2006
New Revision: 16771

URL: http://svn.digium.com/view/asterisk?rev=16771&view=rev
Log:
move a NULL check to before the first time the pointer is dereferenced (issue #6832)

Modified:
    branches/1.2/channels/chan_iax2.c

Modified: branches/1.2/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/channels/chan_iax2.c?rev=16771&r1=16770&r2=16771&view=diff
==============================================================================
--- branches/1.2/channels/chan_iax2.c (original)
+++ branches/1.2/channels/chan_iax2.c Fri Mar 31 13:11:26 2006
@@ -1486,6 +1486,8 @@
 	int res;
 	char iabuf[INET_ADDRSTRLEN];
 	/* Called with iaxsl held */
+	if (!iaxs[f->callno])
+		return -1;
 	if (option_debug > 2 && iaxdebug)
 		ast_log(LOG_DEBUG, "Sending %d on %d/%d to %s:%d\n", f->ts, f->callno, iaxs[f->callno]->peercallno, ast_inet_ntoa(iabuf, sizeof(iabuf), iaxs[f->callno]->addr.sin_addr), ntohs(iaxs[f->callno]->addr.sin_port));
 	/* Don't send if there was an error, but return error instead */
@@ -1493,8 +1495,6 @@
 		ast_log(LOG_WARNING, "Call number = %d\n", f->callno);
 		return -1;
 	}
-	if (!iaxs[f->callno])
-		return -1;
 	if (iaxs[f->callno]->error)
 		return -1;
 	if (f->transfer) {



More information about the asterisk-commits mailing list