Don't return a partially initialized datastore.

If memory allocation fails in ast_strdup(), don't return a partially
initialized datastore.  Bad things may happen.

(related to ABE-2415)


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@273565 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Russell Bryant 15 years ago
parent 9bae102b7c
commit 2a18c6627d

@ -1439,7 +1439,10 @@ struct ast_datastore *ast_channel_datastore_alloc(const struct ast_datastore_inf
datastore->info = info;
datastore->uid = ast_strdup(uid);
if (!ast_strlen_zero(uid) && !(datastore->uid = ast_strdup(uid))) {
ast_free(datastore);
datastore = NULL;
}
return datastore;
}

Loading…
Cancel
Save