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

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
Tue Apr 9 22:00:23 UTC 2019


Harald Welte has uploaded this change for review. ( 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 claling destroy_tlv().

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



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/60/13560/1

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: newchange
Gerrit-Change-Id: Iacc74c9948fb10fa79c0dd7b0cb72d4adbefdeed
Gerrit-Change-Number: 13560
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190409/d53699ad/attachment.htm>


More information about the gerrit-log mailing list