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

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

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Jul 12 18:53:55 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/9956 )

Change subject: fix two memleaks in ipa_rx_msg_sccp()
......................................................................

fix two memleaks in ipa_rx_msg_sccp()

1: Do not call xua_msg_alloc() which is later bluntly overwritten by
m3ua_xfer_from_data().

2: After dispatching to m3ua_hmdc_rx_from_l2(), call xua_msg_free().

Related: OS#3393
Change-Id: I0918f9bbc15b036619f1c25a133b69819b2a30fa
---
M src/ipa.c
1 file changed, 5 insertions(+), 2 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Pau Espin Pedrol: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved



diff --git a/src/ipa.c b/src/ipa.c
index e15b1d8..f3a7a52 100644
--- a/src/ipa.c
+++ b/src/ipa.c
@@ -202,8 +202,9 @@
 
 static int ipa_rx_msg_sccp(struct osmo_ss7_asp *asp, struct msgb *msg)
 {
+	int rc;
 	struct m3ua_data_hdr data_hdr;
-	struct xua_msg *xua = xua_msg_alloc();
+	struct xua_msg *xua;
 	struct osmo_ss7_as *as = find_as_for_asp(asp);
 	uint32_t opc, dpc;
 
@@ -263,7 +264,9 @@
 	m3ua_dh_to_xfer_param(&xua->mtp, &data_hdr);
 
 	/* Pass on as if we had received it from an M3UA ASP */
-	return m3ua_hmdc_rx_from_l2(asp->inst, xua);
+	rc = m3ua_hmdc_rx_from_l2(asp->inst, xua);
+	xua_msg_free(xua);
+	return rc;
 }
 
 /*! \brief process M3UA message received from socket

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

Gerrit-Project: libosmo-sccp
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0918f9bbc15b036619f1c25a133b69819b2a30fa
Gerrit-Change-Number: 9956
Gerrit-PatchSet: 2
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180712/72b767de/attachment.htm>


More information about the gerrit-log mailing list