Change in osmo-bsc[master]: sigtran: fix memleak in osmo_bsc_sigtran_send()

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/.

dexter gerrit-no-reply at lists.osmocom.org
Tue Aug 7 10:31:28 UTC 2018


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/10366


Change subject: sigtran: fix memleak in osmo_bsc_sigtran_send()
......................................................................

sigtran: fix memleak in osmo_bsc_sigtran_send()

The function osmo_bsc_sigtran_send() checks if the MSC is ready by
calling a_reset_conn_ready(). If it is not ready it returns with
-EINVAL. The msg message buffer is not freed, so we leak memory in those
edge cases.

- Make sure msg is freed when MSC is not ready.
- Add a comment that osmo_bsc_sigtran_send() takes ownership of msg

Change-Id: Ib1ff1d20e960a356bcee276b7c1bf9c93283e7af
---
M src/osmo-bsc/osmo_bsc_sigtran.c
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/66/10366/1

diff --git a/src/osmo-bsc/osmo_bsc_sigtran.c b/src/osmo-bsc/osmo_bsc_sigtran.c
index 449f1df..19d4817 100644
--- a/src/osmo-bsc/osmo_bsc_sigtran.c
+++ b/src/osmo-bsc/osmo_bsc_sigtran.c
@@ -338,7 +338,7 @@
 	return rc;
 }
 
-/* Send data to MSC */
+/* Send data to MSC, the function will take ownership of *msg */
 int osmo_bsc_sigtran_send(struct gsm_subscriber_connection *conn, struct msgb *msg)
 {
 	struct osmo_ss7_instance *ss7;
@@ -370,6 +370,7 @@
 
 	if (a_reset_conn_ready(msc->a.reset_fsm) == false) {
 		LOGP(DMSC, LOGL_ERROR, "MSC is not connected. Dropping.\n");
+		msgb_free(msg);
 		return -EINVAL;
 	}
 

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

Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ib1ff1d20e960a356bcee276b7c1bf9c93283e7af
Gerrit-Change-Number: 10366
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180807/1cb5400d/attachment.htm>


More information about the gerrit-log mailing list