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

Richard Mudgett asteriskteam at digium.com
Mon Nov 6 17:33:38 CST 2017


Richard Mudgett 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 an error occurs while packing it does not appear to free any objects tha
If the pack fails it does clean up using the internal unref function for all the refs it has already stolen.

However, there is absolutely no way to know which refs it has already stolen.  The pack may or may not have already stolen the ref.  We don't know where in the packing that the error happened.  We cannot use the 'O' option which gets its own ref rather than stealing it either as the json library ref/unref internal functions are not thread safe so we have to use the ref stealing 'o' option.



-- 
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:33:38 +0000
Gerrit-HasComments: Yes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171106/63620097/attachment.html>


More information about the asterisk-code-review mailing list