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
This commit is contained in:
Corey Farrell
2017-11-06 18:48:06 -05:00
parent 637b37fb98
commit 8684219f79

View File

@@ -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);