diff options
author | Russell Bryant <russell@russellbryant.com> | 2010-07-01 22:16:23 +0000 |
---|---|---|
committer | Russell Bryant <russell@russellbryant.com> | 2010-07-01 22:16:23 +0000 |
commit | 00654ddd160aa7f53f575f4988153ed41d1d0a00 (patch) | |
tree | ace8e8cf9e7c487ad1108a470e716c5045c081f5 | |
parent | b840ef081e9a4aeac1fa22b1698ebef7c8865004 (diff) |
Merged revisions 273565 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r273565 | russell | 2010-07-01 17:09:19 -0500 (Thu, 01 Jul 2010) | 7 lines
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/trunk@273566 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | main/datastore.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/main/datastore.c b/main/datastore.c index 3d097860f..ee471551d 100644 --- a/main/datastore.c +++ b/main/datastore.c @@ -50,7 +50,10 @@ struct ast_datastore *__ast_datastore_alloc(const struct ast_datastore_info *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; } |