From: Walter Doekes Date: Tue, 6 Aug 2013 08:37:37 +0000 (+0000) Subject: Check result of ast_var_assign() calls for memory allocation failure (2). X-Git-Tag: 11.6.0-rc1~3^2~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9dfb4be39d4bf5f670da031573767da3f0983609;p=thirdparty%2Fasterisk.git Check result of ast_var_assign() calls for memory allocation failure (2). Missed a spot in the previous commit. git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@396310 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/funcs/func_strings.c b/funcs/func_strings.c index 2294b8a420..dc11a6b1cd 100644 --- a/funcs/func_strings.c +++ b/funcs/func_strings.c @@ -1806,6 +1806,13 @@ AST_TEST_DEFINE(test_STRREPLACE) char tmp[512], tmp2[512] = ""; struct ast_var_t *var = ast_var_assign("test_string", test_strings[i][0]); + if (!var) { + ast_test_status_update(test, "Unable to allocate variable\n"); + ast_free(str); + ast_channel_release(chan); + return AST_TEST_FAIL; + } + AST_LIST_INSERT_HEAD(ast_channel_varshead(chan), var, entries); if (test_strings[i][3]) {