[Asterisk-code-review] aoc: Fix memory management issues. (asterisk[master])

Corey Farrell asteriskteam at digium.com
Thu Nov 16 19:40:34 CST 2017


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


Change subject: aoc: Fix memory management issues.
......................................................................

aoc: Fix memory management issues.

aoc_publish_blob failed to check for msg allocation error and never
released msg.

Change-Id: Ib31a9ffb81056a0d496a49d7eec795005a44bcd5
---
M main/aoc.c
1 file changed, 4 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/48/7248/1

diff --git a/main/aoc.c b/main/aoc.c
index 451b219..3487948 100644
--- a/main/aoc.c
+++ b/main/aoc.c
@@ -1860,7 +1860,10 @@
 	msg = stasis_message_create(msg_type, aoc_event);
 	ao2_ref(aoc_event, -1);
 
-	stasis_publish(ast_manager_get_topic(), msg);
+	if (msg) {
+		stasis_publish(ast_manager_get_topic(), msg);
+		ao2_ref(msg, -1);
+	}
 }
 
 static struct ast_manager_event_blob *aoc_to_ami(struct stasis_message *message,

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

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib31a9ffb81056a0d496a49d7eec795005a44bcd5
Gerrit-Change-Number: 7248
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/20171116/a09021a3/attachment.html>


More information about the asterisk-code-review mailing list