Change in libosmo-sccp[master]: fix memleaks in mtp_user_prim_cb()

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

laforge gerrit-no-reply at lists.osmocom.org
Tue Jan 7 22:05:35 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/9957 )

Change subject: fix memleaks in mtp_user_prim_cb()
......................................................................

fix memleaks in mtp_user_prim_cb()

After dispatching to scrc_rx_mtp_xfer_ind_xua(), free the xua_msg.

Do not free the xua_msg in any of the code paths triggered within
scrc_rx_mtp_xfer_ind_xua(), i.e. remove xua_msg_free() from:
sccp_scoc_rx_from_scrc()
 +->sccp_scoc_rx_unass_local_ref()
     +->tx_coerr_from_xua()
     +->tx_relco_from_xua()

Before this, some code paths would free the xua_msg, while most code paths
would not, causing mem leaks.

Change-Id: I72b3c6a6f57ba32d9ba191af33b4b236492174e0
---
M src/sccp_scoc.c
M src/sccp_user.c
2 files changed, 1 insertion(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve



diff --git a/src/sccp_scoc.c b/src/sccp_scoc.c
index 7570764..e2768ea 100644
--- a/src/sccp_scoc.c
+++ b/src/sccp_scoc.c
@@ -1413,7 +1413,6 @@
 
 	/* sent to SCRC for transmission */
 	sccp_scrc_rx_scoc_conn_msg(inst, xua);
-	xua_msg_free(xua);
 }
 
 /* Generate a RELCO based in input arguments */
@@ -1451,7 +1450,6 @@
 
 	/* send to SCRC for transmission */
 	sccp_scrc_rx_scoc_conn_msg(inst, xua);
-	xua_msg_free(xua);
 }
 
 /* Generate a RLSD based in input arguments */
diff --git a/src/sccp_user.c b/src/sccp_user.c
index 929445f..49cc212 100644
--- a/src/sccp_user.c
+++ b/src/sccp_user.c
@@ -174,6 +174,7 @@
 		xua->mtp = omp->u.transfer;
 		/* hand this primitive into SCCP via the SCRC code */
 		rc = scrc_rx_mtp_xfer_ind_xua(inst, xua);
+		xua_msg_free(xua);
 		break;
 	default:
 		LOGP(DLSCCP, LOGL_ERROR, "Unknown primitive %u:%u receivd\n",

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/9957
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-Change-Id: I72b3c6a6f57ba32d9ba191af33b4b236492174e0
Gerrit-Change-Number: 9957
Gerrit-PatchSet: 3
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200107/c48b4933/attachment.htm>


More information about the gerrit-log mailing list