[Asterisk-code-review] chan sip: Fix memory leaks. (asterisk[13])
Jenkins2
asteriskteam at digium.com
Tue Dec 19 19:20:40 CST 2017
Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/7649 )
Change subject: chan_sip: Fix memory leaks.
......................................................................
chan_sip: Fix memory leaks.
In change_redirecting_information variables we use ast_strlen_zero to
see if a value should be saved. In the case where the value is not NULL
but is a zero length string we leaked.
handle_response_subscribe leaked a reference to the ccss monitor
instance.
Change-Id: Ib11444de69c3d5b2360a88ba2feb54d2c2e9f05f
---
M channels/chan_sip.c
1 file changed, 10 insertions(+), 1 deletion(-)
Approvals:
Sean Bright: Looks good to me, but someone else must approve
Richard Mudgett: Looks good to me, but someone else must approve
Kevin Harwell: Looks good to me, approved
Jenkins2: Approved for Submit
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 522e9d1..e6e82db 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -23168,6 +23168,8 @@
redirecting->from.number.valid = 1;
ast_free(redirecting->from.number.str);
redirecting->from.number.str = redirecting_from_number;
+ } else {
+ ast_free(redirecting_from_number);
}
if (!ast_strlen_zero(redirecting_from_name)) {
ast_debug(3, "Got redirecting from name %s\n", redirecting_from_name);
@@ -23175,6 +23177,8 @@
redirecting->from.name.valid = 1;
ast_free(redirecting->from.name.str);
redirecting->from.name.str = redirecting_from_name;
+ } else {
+ ast_free(redirecting_from_name);
}
if (!ast_strlen_zero(p->cid_tag)) {
ast_free(redirecting->from.tag);
@@ -23188,13 +23192,17 @@
redirecting->to.number.valid = 1;
ast_free(redirecting->to.number.str);
redirecting->to.number.str = redirecting_to_number;
+ } else {
+ ast_free(redirecting_to_number);
}
if (!ast_strlen_zero(redirecting_to_name)) {
- ast_debug(3, "Got redirecting to name %s\n", redirecting_from_number);
+ ast_debug(3, "Got redirecting to name %s\n", redirecting_to_name);
update_redirecting->to.name = 1;
redirecting->to.name.valid = 1;
ast_free(redirecting->to.name.str);
redirecting->to.name.str = redirecting_to_name;
+ } else {
+ ast_free(redirecting_to_name);
}
redirecting->reason.code = reason;
ast_free(redirecting->reason.str);
@@ -24223,6 +24231,7 @@
ast_cc_monitor_failed(monitor_instance->core_id,
monitor_instance->device_name,
"Received error response to our SUBSCRIBE");
+ ao2_ref(monitor_instance, -1);
}
return;
}
--
To view, visit https://gerrit.asterisk.org/7649
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib11444de69c3d5b2360a88ba2feb54d2c2e9f05f
Gerrit-Change-Number: 7649
Gerrit-PatchSet: 3
Gerrit-Owner: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Richard Mudgett <rmudgett 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-code-review/attachments/20171219/cd64a471/attachment.html>
More information about the asterisk-code-review
mailing list