summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2017-11-06 18:48:06 -0500
committerCorey Farrell <git@cfware.com>2017-11-06 18:52:03 -0500
commit032c657ee9b0f2c83a071d7474c9314fbb525977 (patch)
tree2e7143df61ae0f27d472465ad852f836453eae0e
parent457abd06b4b6e89f80e106ef710bf2cf8932b7f8 (diff)
res_pjsip_exten_state: Check for vector append failure.
Release reference to publisher if we fail to add it to the vector. Change-Id: I64dff3f481b67b9884f37cadba7a5ccf23d084f3
-rw-r--r--res/res_pjsip_exten_state.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/res/res_pjsip_exten_state.c b/res/res_pjsip_exten_state.c
index 95a40829e..3e756134c 100644
--- a/res/res_pjsip_exten_state.c
+++ b/res/res_pjsip_exten_state.c
@@ -729,8 +729,11 @@ static int exten_state_publisher_state_cb(const char *context, const char *exten
}
ao2_ref(publisher, +1);
- AST_VECTOR_APPEND(&pub_data->pubs, publisher);
- ast_debug(5, "'%s' will publish exten state\n", publisher->name);
+ if (AST_VECTOR_APPEND(&pub_data->pubs, publisher)) {
+ ao2_ref(publisher, -1);
+ } else {
+ ast_debug(5, "'%s' will publish exten state\n", publisher->name);
+ }
}
ao2_iterator_destroy(&publisher_iter);