[Asterisk-code-review] res pjsip exten state: Check for vector append failure. (asterisk[15])

Corey Farrell asteriskteam at digium.com
Mon Nov 6 17:52:04 CST 2017


Corey Farrell has uploaded this change for review. ( https://gerrit.asterisk.org/7077


Change subject: res_pjsip_exten_state: Check for vector append failure.
......................................................................

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
---
M res/res_pjsip_exten_state.c
1 file changed, 5 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/77/7077/1

diff --git a/res/res_pjsip_exten_state.c b/res/res_pjsip_exten_state.c
index 95a4082..3e75613 100644
--- a/res/res_pjsip_exten_state.c
+++ b/res/res_pjsip_exten_state.c
@@ -729,8 +729,11 @@
 		}
 
 		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);
 

-- 
To view, visit https://gerrit.asterisk.org/7077
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I64dff3f481b67b9884f37cadba7a5ccf23d084f3
Gerrit-Change-Number: 7077
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171106/a52181e6/attachment-0001.html>


More information about the asterisk-code-review mailing list