[Asterisk-code-review] stasis bridges.c: Fix off-nominal json memory leaks. (asterisk[13])

Kevin Harwell asteriskteam at digium.com
Mon Nov 6 17:47:19 CST 2017


Kevin Harwell has posted comments on this change. ( https://gerrit.asterisk.org/7022 )

Change subject: stasis_bridges.c: Fix off-nominal json memory leaks.
......................................................................


Patch Set 1:

(1 comment)

https://gerrit.asterisk.org/#/c/7022/1/main/stasis_bridges.c
File main/stasis_bridges.c:

https://gerrit.asterisk.org/#/c/7022/1/main/stasis_bridges.c@883
PS1, Line 883: 	if (!out) {
             : 		ast_json_unref(json_target);
             : 		ast_json_unref(json_transferee);
             : 		return NULL;
             : 	}
> If the pack fails it does clean up using the internal unref function for al
Looking at the json pack code it does not appear to clean up any internal refs if there is a packing error. It just returns NULL for most cases.

That being said json_decref checks if the given object exists and also checks if the refcount has already reached zero and the object has been freed. So it should be fine to call unref on these those two objects just in case they have not already been freed.



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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: comment
Gerrit-Change-Id: Ib1181a36b317c86bff1ef2e44a17a0b1c73cfdc8
Gerrit-Change-Number: 7022
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: Richard Mudgett <rmudgett at digium.com>
Gerrit-Comment-Date: Mon, 06 Nov 2017 23:47:19 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171106/f1859a43/attachment.html>


More information about the asterisk-code-review mailing list