[Asterisk-code-review] endpoint snapshot: avoid second cleanup on alloc failure (asterisk[13])

Scott Griepentrog asteriskteam at digium.com
Fri Sep 4 09:33:33 CDT 2015


Scott Griepentrog has uploaded a new change for review.

  https://gerrit.asterisk.org/1184

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


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/84/1184/1

diff --git a/main/endpoints.c b/main/endpoints.c
index ce0ab02..0155adf 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/1184
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: If4d9dfb1bbe3836b623642ec690b6d49b25e8979
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Scott Griepentrog <sgriepentrog at digium.com>



More information about the asterisk-code-review mailing list