replace malloc+memset with a call to ast_calloc, also removing the error
message that is no longer necessary (issue #6205) git-svn-id: http://svn.digium.com/svn/asterisk/trunk@7985 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
parent
d9d4aadd30
commit
1e9f9a2127
|
@ -1359,13 +1359,10 @@ static struct adsi_script *compile_script(char *script)
|
||||||
ast_log(LOG_WARNING, "Can't open file '%s'\n", fn);
|
ast_log(LOG_WARNING, "Can't open file '%s'\n", fn);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
scr = malloc(sizeof(struct adsi_script));
|
if (!(scr = ast_calloc(1, sizeof(*scr)))) {
|
||||||
if (!scr) {
|
|
||||||
fclose(f);
|
fclose(f);
|
||||||
ast_log(LOG_WARNING, "Out of memory loading script '%s'\n", fn);
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(scr, 0, sizeof(struct adsi_script));
|
|
||||||
/* Create "main" as first subroutine */
|
/* Create "main" as first subroutine */
|
||||||
getsubbyname(scr, "main", NULL, 0);
|
getsubbyname(scr, "main", NULL, 0);
|
||||||
while(!feof(f)) {
|
while(!feof(f)) {
|
||||||
|
|
Reference in New Issue