[asterisk-commits] res sorcery realtime.c: Fix ref leak if object failed to apply. (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Feb 5 12:57:55 CST 2018


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

Change subject: res_sorcery_realtime.c: Fix ref leak if object failed to apply.
......................................................................

res_sorcery_realtime.c: Fix ref leak if object failed to apply.

Change-Id: I3c7106ff77009754725cee790eadf5da44154ab6
---
M res/res_sorcery_realtime.c
1 file changed, 4 insertions(+), 1 deletion(-)

Approvals:
  Corey Farrell: Looks good to me, but someone else must approve
  Sean Bright: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/res/res_sorcery_realtime.c b/res/res_sorcery_realtime.c
index 9b0b25f..c74e1c1 100644
--- a/res/res_sorcery_realtime.c
+++ b/res/res_sorcery_realtime.c
@@ -178,6 +178,7 @@
 	if (!id
 		|| !(object = ast_sorcery_alloc(sorcery, type, id->value))
 		|| ast_sorcery_objectset_apply(sorcery, object, objectset)) {
+		ao2_cleanup(object);
 		return NULL;
 	}
 
@@ -235,7 +236,9 @@
 
 		objectset = sorcery_realtime_filter_objectset(objectset, &id, sorcery, type);
 
-		if (id && (object = ast_sorcery_alloc(sorcery, type, id->value)) && !ast_sorcery_objectset_apply(sorcery, object, objectset)) {
+		if (id
+			&& (object = ast_sorcery_alloc(sorcery, type, id->value))
+			&& !ast_sorcery_objectset_apply(sorcery, object, objectset)) {
 			ao2_link(objects, object);
 		}
 

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: I3c7106ff77009754725cee790eadf5da44154ab6
Gerrit-Change-Number: 8152
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20180205/9b3968bd/attachment.html>


More information about the asterisk-commits mailing list