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

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Thu May 9 19:56:18 UTC 2019


Vadim Yanitskiy has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/53/13953/1

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: newchange
Gerrit-Change-Id: Ic174f6eecd6254af597dfbdc1c9e3d65716f0a76
Gerrit-Change-Number: 13953
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190509/2eeb6dd8/attachment.htm>


More information about the gerrit-log mailing list