[asterisk-commits] trunk - r7985 /trunk/apps/app_adsiprog.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Wed Jan 11 12:40:44 CST 2006


Author: russell
Date: Wed Jan 11 12:40:42 2006
New Revision: 7985

URL: http://svn.digium.com/view/asterisk?rev=7985&view=rev
Log:
replace malloc+memset with a call to ast_calloc, also removing the error
message that is no longer necessary (issue #6205)

Modified:
    trunk/apps/app_adsiprog.c

Modified: trunk/apps/app_adsiprog.c
URL: http://svn.digium.com/view/asterisk/trunk/apps/app_adsiprog.c?rev=7985&r1=7984&r2=7985&view=diff
==============================================================================
--- trunk/apps/app_adsiprog.c (original)
+++ trunk/apps/app_adsiprog.c Wed Jan 11 12:40:42 2006
@@ -1359,13 +1359,10 @@
 		ast_log(LOG_WARNING, "Can't open file '%s'\n", fn);
 		return NULL;
 	}
-	scr = malloc(sizeof(struct adsi_script));
-	if (!scr) {
+	if (!(scr = ast_calloc(1, sizeof(*scr)))) {
 		fclose(f);
-		ast_log(LOG_WARNING, "Out of memory loading script '%s'\n", fn);
 		return NULL;
 	}
-	memset(scr, 0, sizeof(struct adsi_script));
 	/* Create "main" as first subroutine */
 	getsubbyname(scr, "main", NULL, 0);
 	while(!feof(f)) {



More information about the asterisk-commits mailing list