[Asterisk-code-review] stasis: Release object if vector append fails. (asterisk[master])

Corey Farrell asteriskteam at digium.com
Mon Nov 6 15:36:16 CST 2017


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


Change subject: stasis: Release object if vector append fails.
......................................................................

stasis: Release object if vector append fails.

Change-Id: I3e5cc669169aab6175ddfaf7486edeaeb4fdcfb1
---
M main/stasis.c
1 file changed, 2 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/42/7042/1

diff --git a/main/stasis.c b/main/stasis.c
index a82e938..4328b84 100644
--- a/main/stasis.c
+++ b/main/stasis.c
@@ -1239,10 +1239,9 @@
 void ast_multi_object_blob_add(struct ast_multi_object_blob *multi,
 	enum stasis_user_multi_object_snapshot_type type, void *object)
 {
-	if (!multi || !object) {
-		return;
+	if (!multi || !object || AST_VECTOR_APPEND(&multi->snapshots[type], object)) {
+		ao2_cleanup(object);
 	}
-	AST_VECTOR_APPEND(&multi->snapshots[type],object);
 }
 
 /*! \brief Publish single channel user event (for app_userevent compatibility) */

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3e5cc669169aab6175ddfaf7486edeaeb4fdcfb1
Gerrit-Change-Number: 7042
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/ec2b6fb8/attachment.html>


More information about the asterisk-code-review mailing list