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

Jenkins2 asteriskteam at digium.com
Tue Nov 7 16:11:13 CST 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/7044 )

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(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, but someone else must approve
  Richard Mudgett: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/main/stasis.c b/main/stasis.c
index 48e4eb5..42d8651 100644
--- a/main/stasis.c
+++ b/main/stasis.c
@@ -1241,10 +1241,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/7044
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: I3e5cc669169aab6175ddfaf7486edeaeb4fdcfb1
Gerrit-Change-Number: 7044
Gerrit-PatchSet: 1
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171107/c8081e30/attachment.html>


More information about the asterisk-code-review mailing list