]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Check result of ast_var_assign() calls for memory allocation failure (2).
authorWalter Doekes <walter+asterisk@wjd.nu>
Tue, 6 Aug 2013 08:37:37 +0000 (08:37 +0000)
committerWalter Doekes <walter+asterisk@wjd.nu>
Tue, 6 Aug 2013 08:37:37 +0000 (08:37 +0000)
Missed a spot in the previous commit.

git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/11@396310 65c4cc65-6c06-0410-ace0-fbb531ad65f3

funcs/func_strings.c

index 2294b8a4202fd473758c3d7702fc2bcf42b50296..dc11a6b1cd20ba4199ca33209aa73e2afabd24a6 100644 (file)
@@ -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]) {