- conversions to allocation wrappers

- replace malloc/memset with ast_calloc
- replace malloc/ast_copy_string with ast_strdup
(based on patch from issue #6299)


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@8410 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Russell Bryant
2006-01-21 22:09:06 +00:00
parent 039ee896c7
commit efae38a82d
6 changed files with 51 additions and 101 deletions

View File

@@ -215,13 +215,10 @@ static struct ast_key *try_load_key (char *dir, char *fname, int ifd, int ofd, i
/* Make fname just be the normal name now */
*c = '\0';
if (!key) {
key = (struct ast_key *)malloc(sizeof(struct ast_key));
if (!key) {
ast_log(LOG_WARNING, "Out of memory\n");
if (!(key = ast_calloc(1, sizeof(*key)))) {
fclose(f);
return NULL;
}
memset(key, 0, sizeof(struct ast_key));
}
/* At this point we have a key structure (old or new). Time to
fill it with what we know */