Merge "res_pjsip_exten_state: Check for vector append failure."
authorJenkins2 <jenkins2@gerrit.asterisk.org>
Wed, 8 Nov 2017 02:06:26 +0000 (20:06 -0600)
committerGerrit Code Review <gerrit2@gerrit.digium.api>
Wed, 8 Nov 2017 02:06:27 +0000 (20:06 -0600)
res/res_pjsip_exten_state.c

index 95a4082..3e75613 100644 (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);