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
This commit is contained in:
Harald Welte 2019-04-09 23:58:55 +02:00 committed by Vadim Yanitskiy
parent f8af776fba
commit 5dede769e7
1 changed files with 7 additions and 2 deletions

View File

@ -520,7 +520,9 @@ static int smpp_handle_bind_tx(struct osmo_esme *esme, struct msgb *msg)
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 @@ int smpp_tx_alert(struct osmo_esme *esme, uint8_t ton, uint8_t npi,
{
struct alert_notification_t alert;
struct tlv_t tlv;
int rc;
memset(&alert, 0, sizeof(alert));
alert.command_length = 0;
@ -652,7 +655,9 @@ int smpp_tx_alert(struct osmo_esme *esme, uint8_t ton, uint8_t npi,
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 */