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/


git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@396279 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Walter Doekes
2013-08-06 08:14:59 +00:00
parent 950419022f
commit 612bf744b4
9 changed files with 50 additions and 35 deletions

View File

@@ -1591,6 +1591,12 @@ AST_TEST_DEFINE(test_FIELDNUM)
for (i = 0; i < ARRAY_LEN(test_args); i++) {
struct ast_var_t *var = ast_var_assign("FIELDS", test_args[i].fields);
if (!var) {
ast_test_status_update(test, "Out of memory\n");
res = AST_TEST_FAIL;
break;
}
AST_LIST_INSERT_HEAD(&chan->varshead, var, entries);
snprintf(expression, sizeof(expression), "${FIELDNUM(%s,%s,%s)}", var->name, test_args[i].delim, test_args[i].field);