[asterisk-commits] mmichelson: branch group/issue8824 r183236 - /team/group/issue8824/channels/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Mar 19 12:37:58 CDT 2009


Author: mmichelson
Date: Thu Mar 19 12:37:48 2009
New Revision: 183236

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=183236
Log:
Handle allocation failures of ast_strdupa calls in chan_local


Modified:
    team/group/issue8824/channels/chan_local.c

Modified: team/group/issue8824/channels/chan_local.c
URL: http://svn.digium.com/svn-view/asterisk/team/group/issue8824/channels/chan_local.c?view=diff&rev=183236&r1=183235&r2=183236
==============================================================================
--- team/group/issue8824/channels/chan_local.c (original)
+++ team/group/issue8824/channels/chan_local.c Thu Mar 19 12:37:48 2009
@@ -542,11 +542,18 @@
 	/*
 	 * Note that cid_num and cid_name aren't passed in the ast_channel_alloc
 	 * call, so it's done here instead.
+	 *
+	 * All these failure points just return -1. The individual strings will
+	 * be cleared when we destroy the channel.
 	 */
-	p->chan->cid.cid_rdnis = ast_strdup(p->owner->cid.cid_rdnis);
+	if (!(p->chan->cid.cid_rdnis = ast_strdup(p->owner->cid.cid_rdnis))) {
+		return -1;
+	}
 	ast_party_redirecting_copy(&p->chan->redirecting, &p->owner->redirecting);
 
-	p->chan->cid.cid_dnid = ast_strdup(p->owner->cid.cid_dnid);
+	if (!(p->chan->cid.cid_dnid = ast_strdup(p->owner->cid.cid_dnid))) {
+		return -1;
+	}
 	p->chan->cid.cid_tns = p->owner->cid.cid_tns;
 
 	ast_copy_connected_to_caller(&p->chan->cid, &p->owner->connected);




More information about the asterisk-commits mailing list