diff options
author | Walter Doekes <walter+asterisk@wjd.nu> | 2013-08-06 08:36:15 +0000 |
---|---|---|
committer | Walter Doekes <walter+asterisk@wjd.nu> | 2013-08-06 08:36:15 +0000 |
commit | ccdfe67bf2f1c9ea00b522a4e59d7e245b7fb7df (patch) | |
tree | d3a4da66d1745e10c8023891fe47259c04b38d73 /apps | |
parent | c0f302e1e109a640ad4a1e1b308bb8732f85989d (diff) |
Check result of ast_var_assign() calls for memory allocation failure.
We try to keep the system running even when all available memory is
spent.
Review: https://reviewboard.asterisk.org/r/2734/
........
Merged revisions 396279 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 396287 from http://svn.asterisk.org/svn/asterisk/branches/11
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396309 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps')
-rw-r--r-- | apps/app_playback.c | 4 | ||||
-rw-r--r-- | apps/app_stack.c | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/apps/app_playback.c b/apps/app_playback.c index 148657d8d..e7d414301 100644 --- a/apps/app_playback.c +++ b/apps/app_playback.c @@ -220,6 +220,10 @@ static int do_say(say_args_t *a, const char *s, const char *options, int depth) s = x + 1; ast_debug(2, "value is <%s>\n", s); n = ast_var_assign("SAY", s); + if (!n) { + ast_log(LOG_ERROR, "Memory allocation error in do_say\n"); + return -1; + } AST_LIST_INSERT_HEAD(&head, n, entries); /* scan the body, one piece at a time */ diff --git a/apps/app_stack.c b/apps/app_stack.c index 0d6657307..fb665beb2 100644 --- a/apps/app_stack.c +++ b/apps/app_stack.c @@ -273,8 +273,9 @@ static int frame_set_var(struct ast_channel *chan, struct gosub_stack_frame *fra } if (!found) { - variables = ast_var_assign(var, ""); - AST_LIST_INSERT_HEAD(&frame->varshead, variables, entries); + if ((variables = ast_var_assign(var, ""))) { + AST_LIST_INSERT_HEAD(&frame->varshead, variables, entries); + } pbx_builtin_pushvar_helper(chan, var, value); } else { pbx_builtin_setvar_helper(chan, var, value); |