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
This commit is contained in:
Walter Doekes
2013-08-06 08:37:37 +00:00
parent 5c8ba4c4d6
commit 9dfb4be39d

View 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]) {