Change in osmo-msc[master]: libmsc/ran_peer.c: fix msgb memleak in ran_peer_rx_reset()

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Thu May 9 20:08:10 UTC 2019


Vadim Yanitskiy has submitted this change and it was merged. ( https://gerrit.osmocom.org/13953 )

Change subject: libmsc/ran_peer.c: fix msgb memleak in ran_peer_rx_reset()
......................................................................

libmsc/ran_peer.c: fix msgb memleak in ran_peer_rx_reset()

It was noticed that SCCP_RAN_MSG_RESET_ACK message is not freed after
sending. Since ran_peer_rx_reset() calls sccp_ran_down_l2_cl(), which
then calls osmo_sccp_user_sap_down_nofree(), which doesn't free the
message buffer (what's clear from its name).

  OsmoMSC# show talloc-context application full filter msgb
  full talloc report on 'osmo_msc' (total  20155 bytes in  88 blocks)
    msgb                  contains   4640 bytes in   5 blocks (ref 0)
      bssmap: reset ack   contains   1160 bytes in   1 blocks (ref 0)
      bssmap: reset ack   contains   1160 bytes in   1 blocks (ref 0)
      bssmap: reset ack   contains   1160 bytes in   1 blocks (ref 0)

Let's free it after sending (or in case of error).

Change-Id: Ic174f6eecd6254af597dfbdc1c9e3d65716f0a76
---
M src/libmsc/ran_peer.c
1 file changed, 4 insertions(+), 0 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libmsc/ran_peer.c b/src/libmsc/ran_peer.c
index ac2bb4f..40040a2 100644
--- a/src/libmsc/ran_peer.c
+++ b/src/libmsc/ran_peer.c
@@ -140,11 +140,15 @@
 	if (sccp_ran_down_l2_cl(rp->sri, &rp->peer_addr, reset_ack)) {
 		LOG_RAN_PEER(rp, LOGL_ERROR, "Failed to send RESET ACKNOWLEDGE message\n");
 		ran_peer_state_chg(rp, RAN_PEER_ST_WAIT_RX_RESET);
+		msgb_free(reset_ack);
 		return;
 	}
 
 	LOG_RAN_PEER(rp, LOGL_INFO, "Sent RESET ACKNOWLEDGE\n");
 
+	/* sccp_ran_down_l2_cl() doesn't free msgb */
+	msgb_free(reset_ack);
+
 	ran_peer_state_chg(rp, RAN_PEER_ST_READY);
 }
 

-- 
To view, visit https://gerrit.osmocom.org/13953
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic174f6eecd6254af597dfbdc1c9e3d65716f0a76
Gerrit-Change-Number: 13953
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190509/281c415e/attachment.html>


More information about the gerrit-log mailing list