[asterisk-commits] endpoint snapshot: avoid second cleanup on alloc failure (asterisk[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Sat Sep 5 18:48:26 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: endpoint snapshot: avoid second cleanup on alloc failure
......................................................................


endpoint snapshot: avoid second cleanup on alloc failure

In ast_endpoint_snapshot_create(), a failure to init the
string fields results in two attempts to ao2_cleanup the
same pointer.  Removed RAII_VAR to eliminate problem.

ASTERISK-25375 #close
Reported by: Scott Griepentrog

Change-Id: If4d9dfb1bbe3836b623642ec690b6d49b25e8979
---
M main/endpoints.c
1 file changed, 1 insertion(+), 2 deletions(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, approved
  Joshua Colp: Looks good to me, but someone else must approve



diff --git a/main/endpoints.c b/main/endpoints.c
index df9d289..2132656 100644
--- a/main/endpoints.c
+++ b/main/endpoints.c
@@ -464,7 +464,7 @@
 struct ast_endpoint_snapshot *ast_endpoint_snapshot_create(
 	struct ast_endpoint *endpoint)
 {
-	RAII_VAR(struct ast_endpoint_snapshot *, snapshot, NULL, ao2_cleanup);
+	struct ast_endpoint_snapshot *snapshot;
 	int channel_count;
 	struct ao2_iterator i;
 	void *obj;
@@ -500,7 +500,6 @@
 	}
 	ao2_iterator_destroy(&i);
 
-	ao2_ref(snapshot, +1);
 	return snapshot;
 }
 

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If4d9dfb1bbe3836b623642ec690b6d49b25e8979
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Ashley Sanders <asanders at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list