[svn-commits] eliel: branch group/data_api_gsoc2009 r205659 - /team/group/data_api_gsoc2009...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jul 9 12:58:39 CDT 2009


Author: eliel
Date: Thu Jul  9 12:58:35 2009
New Revision: 205659

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205659
Log:
Check for allocation failure and use ast_free instead of free().


Modified:
    team/group/data_api_gsoc2009/main/data.c

Modified: team/group/data_api_gsoc2009/main/data.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/main/data.c?view=diff&rev=205659&r1=205658&r2=205659
==============================================================================
--- team/group/data_api_gsoc2009/main/data.c (original)
+++ team/group/data_api_gsoc2009/main/data.c Thu Jul  9 12:58:35 2009
@@ -1091,7 +1091,7 @@
 			data_filter_list_destroy(&(node->children));
 		}
 
-		free(node);
+		ast_free(node);
 	}
 }
 
@@ -1111,6 +1111,10 @@
 	for (token = strtok(path, "/"); token; token = strtok(NULL, "/")) {
 		if (!flist) {
 			flist = ast_calloc(1, sizeof(*flist));
+			if (!flist) {
+				/* XXX: release already allocated memory. */
+				return NULL;
+			}
 		} else {
 			found = 0;
 
@@ -1127,6 +1131,10 @@
 		}
 
 		node = ast_calloc(1, sizeof(*node));
+		if (!node) {
+			/* XXX: release already allocated memory. */
+			return NULL;
+		}
 		*(node->name) = '/';
 		strcpy(node->name + 1, token);
 		AST_LIST_INSERT_TAIL(flist, node, next);
@@ -1145,7 +1153,7 @@
 {
 	struct data_filter_list *filter = NULL;
 	char *strfilter = ast_strdupa(constfilter), *token;
-	
+
 	for (token = strtok(strfilter, ","); token; token = strtok(NULL, ",")) {
 		filter = data_filter_add_node(filter, token);
 	}




More information about the svn-commits mailing list