}
/* ... include new context into context list, unlock, return */
- AST_VECTOR_APPEND(&con->includes, new_include);
+ if (AST_VECTOR_APPEND(&con->includes, new_include)) {
+ include_free(new_include);
+ ast_unlock_context(con);
+ return -1;
+ }
ast_verb(3, "Including context '%s' in context '%s'\n",
ast_get_include_name(new_include), ast_get_context_name(con));
}
/* ... sw new context into context list, unlock, return */
- AST_VECTOR_APPEND(&con->alts, new_sw);
+ if (AST_VECTOR_APPEND(&con->alts, new_sw)) {
+ sw_free(new_sw);
+ ast_unlock_context(con);
+ return -1;
+ }
ast_verb(3, "Including switch '%s/%s' in context '%s'\n",
ast_get_switch_name(new_sw), ast_get_switch_data(new_sw), ast_get_context_name(con));
return -1;
}
}
- AST_VECTOR_APPEND(&con->ignorepats, ignorepat);
+ if (AST_VECTOR_APPEND(&con->ignorepats, ignorepat)) {
+ ignorepat_free(ignorepat);
+ ast_unlock_context(con);
+ return -1;
+ }
ast_unlock_context(con);
return 0;