summaryrefslogtreecommitdiff
path: root/res/res_pjsip_exten_state.c
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:48:06 -0500
commit8684219f79481b5ea18ac88911d7c381290c8919 (patch)
treeb4ba84a2543e4dffda7a8869c22a9f9e21fc8458 /res/res_pjsip_exten_state.c
parent637b37fb980822f50966f5292a786d03a859cd89 (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
Diffstat (limited to 'res/res_pjsip_exten_state.c')
-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);