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 <nhofm...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pes...@sysmocom.de>

Reply via email to