[Asterisk-code-review] stasis bridges.c: Fix off-nominal json memory leaks. (asterisk[13])
Richard Mudgett
asteriskteam at digium.com
Mon Nov 6 12:10:26 CST 2017
Richard Mudgett has uploaded this change for review. ( https://gerrit.asterisk.org/7022
Change subject: stasis_bridges.c: Fix off-nominal json memory leaks.
......................................................................
stasis_bridges.c: Fix off-nominal json memory leaks.
Change-Id: Ib1181a36b317c86bff1ef2e44a17a0b1c73cfdc8
---
M main/stasis_bridges.c
1 file changed, 8 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/22/7022/1
diff --git a/main/stasis_bridges.c b/main/stasis_bridges.c
index 8f97e98..413c9be 100644
--- a/main/stasis_bridges.c
+++ b/main/stasis_bridges.c
@@ -857,6 +857,8 @@
if (transfer_msg->transferee) {
json_transferee = ast_channel_snapshot_to_json(transfer_msg->transferee, sanitize);
if (!json_transferee) {
+ ast_json_unref(json_transferer2);
+ ast_json_unref(json_transferer1);
return NULL;
}
}
@@ -864,6 +866,9 @@
if (transfer_msg->target) {
json_target = ast_channel_snapshot_to_json(transfer_msg->target, sanitize);
if (!json_target) {
+ ast_json_unref(json_transferee);
+ ast_json_unref(json_transferer2);
+ ast_json_unref(json_transferer1);
return NULL;
}
}
@@ -876,9 +881,12 @@
"result", result_strs[transfer_msg->result],
"is_external", ast_json_boolean(transfer_msg->is_external));
if (!out) {
+ ast_json_unref(json_target);
+ ast_json_unref(json_transferee);
return NULL;
}
if (json_transferee && ast_json_object_set(out, "transferee", json_transferee)) {
+ ast_json_unref(json_target);
return NULL;
}
if (json_target && ast_json_object_set(out, "transfer_target", json_target)) {
--
To view, visit https://gerrit.asterisk.org/7022
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1181a36b317c86bff1ef2e44a17a0b1c73cfdc8
Gerrit-Change-Number: 7022
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171106/547d239b/attachment.html>
More information about the asterisk-code-review
mailing list