From ccdfe67bf2f1c9ea00b522a4e59d7e245b7fb7df Mon Sep 17 00:00:00 2001 From: Walter Doekes Date: Tue, 6 Aug 2013 08:36:15 +0000 Subject: 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 --- main/pbx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'main/pbx.c') diff --git a/main/pbx.c b/main/pbx.c index 9ef2f1ed0..4c95b278f 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -10911,10 +10911,9 @@ void pbx_builtin_pushvar_helper(struct ast_channel *chan, const char *name, cons headp = &globals; } - if (value) { + if (value && (newvariable = ast_var_assign(name, value))) { if (headp == &globals) ast_verb(2, "Setting global variable '%s' to '%s'\n", name, value); - newvariable = ast_var_assign(name, value); AST_LIST_INSERT_HEAD(headp, newvariable, entries); } @@ -10961,10 +10960,9 @@ int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const } AST_LIST_TRAVERSE_SAFE_END; - if (value) { + if (value && (newvariable = ast_var_assign(name, value))) { if (headp == &globals) ast_verb(2, "Setting global variable '%s' to '%s'\n", name, value); - newvariable = ast_var_assign(name, value); AST_LIST_INSERT_HEAD(headp, newvariable, entries); ast_channel_publish_varset(chan, name, value); -- cgit v1.2.3