[asterisk-commits] eliel: branch group/data_api_gsoc2009 r206380 - /team/group/data_api_gsoc2009...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Jul 14 08:09:17 CDT 2009


Author: eliel
Date: Tue Jul 14 08:09:14 2009
New Revision: 206380

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=206380
Log:
Use a dynamic buffer, i don't know how long the search line could be.


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=206380&r1=206379&r2=206380
==============================================================================
--- team/group/data_api_gsoc2009/main/data.c (original)
+++ team/group/data_api_gsoc2009/main/data.c Tue Jul 14 08:09:14 2009
@@ -840,15 +840,30 @@
 
 	search_string_len = strlen(search_string);
 
-	name = ast_str_alloca(search_string_len);
-	value = ast_str_alloca(search_string_len);
-	comparison = ast_str_alloca(search_string_len);
+	name = ast_str_create(search_string_len);
+	if (!name) {
+		return NULL;
+	}
+	value = ast_str_create(search_string_len);
+	if (!value) {
+		ast_free(name);
+		return NULL;
+	}
+	comparison = ast_str_create(search_string_len);
+	if (!comparison) {
+		ast_free(name);
+		ast_free(value);
+		return NULL;
+	}
 
 	search_string_dup = ast_strdupa(search_string);
 
 	/* Create the root node (just used as a container) */
 	root = data_search_alloc("/");
 	if (!root) {
+		ast_free(name);
+		ast_free(value);
+		ast_free(comparison);
 		return NULL;
 	}
 
@@ -895,6 +910,10 @@
 
 		ao2_ref(child, -1);
 	}
+
+	ast_free(name);
+	ast_free(value);
+	ast_free(comparison);
 
 	return root;
 }




More information about the asterisk-commits mailing list