Change in osmo-msc[master]: smpp_smsc: Call destroy_tlv() when using build_tlv()

Vadim Yanitskiy gerrit-no-reply at lists.osmocom.org
Wed Apr 10 10:53:23 UTC 2019


Vadim Yanitskiy has submitted this change and it was merged. ( https://gerrit.osmocom.org/13560 )

Change subject: smpp_smsc: Call destroy_tlv() when using build_tlv()
......................................................................

smpp_smsc: Call destroy_tlv() when using build_tlv()

The libsmpp34 build_tlv() function is allocating dynamic memory
which we need to release again by calling destroy_tlv().

Change-Id: Iacc74c9948fb10fa79c0dd7b0cb72d4adbefdeed
Closes: OS#3912
---
M src/libmsc/smpp_smsc.c
1 file changed, 7 insertions(+), 2 deletions(-)

Approvals:
  Vadim Yanitskiy: Looks good to me, approved
  Pau Espin Pedrol: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/libmsc/smpp_smsc.c b/src/libmsc/smpp_smsc.c
index 2350d84..3bfb81a 100644
--- a/src/libmsc/smpp_smsc.c
+++ b/src/libmsc/smpp_smsc.c
@@ -520,7 +520,9 @@
 	tlv.value.val16 = esme->smpp_version;
 	build_tlv(&bind_r.tlv, &tlv);
 
-	return PACK_AND_SEND(esme, &bind_r);
+	rc = PACK_AND_SEND(esme, &bind_r);
+	destroy_tlv(bind_r.tlv);
+	return rc;
 }
 
 /*! \brief handle an incoming SMPP BIND TRANSCEIVER */
@@ -632,6 +634,7 @@
 {
 	struct alert_notification_t alert;
 	struct tlv_t tlv;
+	int rc;
 
 	memset(&alert, 0, sizeof(alert));
 	alert.command_length	= 0;
@@ -652,7 +655,9 @@
 		alert.source_addr_npi,
 		get_value_string(smpp_avail_strs, avail_status));
 
-	return PACK_AND_SEND(esme, &alert);
+	rc = PACK_AND_SEND(esme, &alert);
+	destroy_tlv(alert.tlv);
+	return rc;
 }
 
 /* \brief send a DELIVER-SM message to given ESME */

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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Iacc74c9948fb10fa79c0dd7b0cb72d4adbefdeed
Gerrit-Change-Number: 13560
Gerrit-PatchSet: 3
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Assignee: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Vadim Yanitskiy <axilirator at gmail.com>
Gerrit-CC: fixeria <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190410/56bca42e/attachment.html>


More information about the gerrit-log mailing list