summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Colp <jcolp@digium.com>2017-11-07 15:23:21 -0600
committerGerrit Code Review <gerrit2@gerrit.digium.api>2017-11-07 15:23:21 -0600
commitafc53cbe1c630a7fd3b8531f9b7ec9a95b3f04a2 (patch)
treea7e5b2701d528016ff643b3916879598fdaa3e22
parent6cf44ee48e31357c64e85d748b53cd5891eb8f0d (diff)
parenta85b76289479c32f0ac5e7321042dfc47b0a4934 (diff)
Merge "PBX: Handle errors from AST_VECTOR_APPEND." into 15
-rw-r--r--main/pbx.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/main/pbx.c b/main/pbx.c
index 2366b72b0..b5602b55c 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -6692,7 +6692,11 @@ int ast_context_add_include2(struct ast_context *con, const char *value,
}
/* ... 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));
@@ -6754,7 +6758,11 @@ int ast_context_add_switch2(struct ast_context *con, const char *value,
}
/* ... 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));
@@ -6842,7 +6850,11 @@ int ast_context_add_ignorepat2(struct ast_context *con, const char *value, const
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;