[asterisk-commits] simon.perreault: branch group/v6-new r273956 - /team/group/v6-new/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 5 09:31:40 CDT 2010


Author: simon.perreault
Date: Mon Jul  5 09:31:36 2010
New Revision: 273956

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=273956
Log:
Be prepared to handle a NULL return from ast_malloc()

Modified:
    team/group/v6-new/main/netsock2.c

Modified: team/group/v6-new/main/netsock2.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/main/netsock2.c?view=diff&rev=273956&r1=273955&r2=273956
==============================================================================
--- team/group/v6-new/main/netsock2.c (original)
+++ team/group/v6-new/main/netsock2.c Mon Jul  5 09:31:36 2010
@@ -244,7 +244,10 @@
 		res_cnt++;
 	}
 
-	*addrs = ast_malloc(res_cnt * sizeof(struct ast_sockaddr));
+	if ((*addrs = ast_malloc(res_cnt * sizeof(struct ast_sockaddr))) == NULL) {
+		res_cnt = 0;
+		goto cleanup;
+	}
 
 	i = 0;
 	for (ai = res; ai; ai = ai->ai_next) {
@@ -253,6 +256,7 @@
 		++i;
 	}
 
+cleanup:
 	freeaddrinfo(res);
 	return res_cnt;
 }




More information about the asterisk-commits mailing list