[svn-commits] russell: branch 1.4 r273565 - /branches/1.4/main/channel.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 1 17:09:23 CDT 2010


Author: russell
Date: Thu Jul  1 17:09:19 2010
New Revision: 273565

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=273565
Log:
Don't return a partially initialized datastore.

If memory allocation fails in ast_strdup(), don't return a partially
initialized datastore.  Bad things may happen.

(related to ABE-2415)

Modified:
    branches/1.4/main/channel.c

Modified: branches/1.4/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/main/channel.c?view=diff&rev=273565&r1=273564&r2=273565
==============================================================================
--- branches/1.4/main/channel.c (original)
+++ branches/1.4/main/channel.c Thu Jul  1 17:09:19 2010
@@ -1439,7 +1439,10 @@
 
 	datastore->info = info;
 
-	datastore->uid = ast_strdup(uid);
+	if (!ast_strlen_zero(uid) && !(datastore->uid = ast_strdup(uid))) {
+		ast_free(datastore);
+		datastore = NULL;
+	}
 
 	return datastore;
 }




More information about the svn-commits mailing list