diff options
author | Keith Whyte <keith@rhizomatica.org> | 2023-07-21 20:09:08 +0100 |
---|---|---|
committer | Keith Whyte <keith@rhizomatica.org> | 2023-07-21 21:11:14 +0100 |
commit | c54ce6a4b58800f72c66d0f47554036a9f0e39fe (patch) | |
tree | c874dd4ffe0fc5c4d9b55d905e8580c10be0231e /src | |
parent | 482f0bd5a1812838c4ae1a2546dedaddc5fff87d (diff) |
SMPP: Fix Memory leaks
Whenever we call build_tlv() we must
call destroy_tlv() after we are finished with it.
Similarly, smpp34_unpack() makes calls to smpp34_malloc()
and these need to be free'd by us later.
Change-Id: Ic2abcbe78cf7cf7b6ce36fe09aa9b4f8daee973f
Diffstat (limited to 'src')
-rw-r--r-- | src/libsmpputil/smpp_msc.c | 1 | ||||
-rw-r--r-- | src/libsmpputil/smpp_smsc.c | 2 |
2 files changed, 3 insertions, 0 deletions
diff --git a/src/libsmpputil/smpp_msc.c b/src/libsmpputil/smpp_msc.c index fed5858b0..cf175407a 100644 --- a/src/libsmpputil/smpp_msc.c +++ b/src/libsmpputil/smpp_msc.c @@ -788,6 +788,7 @@ static int deliver_to_esme(struct smpp_esme *esme, struct gsm_sms *sms, sms->msg_ref); ret = smpp_tx_deliver(esme, &deliver); + destroy_tlv(deliver.tlv); if (ret < 0) return ret; diff --git a/src/libsmpputil/smpp_smsc.c b/src/libsmpputil/smpp_smsc.c index 314dc6021..34e24c513 100644 --- a/src/libsmpputil/smpp_smsc.c +++ b/src/libsmpputil/smpp_smsc.c @@ -694,6 +694,7 @@ static int smpp_handle_submit(struct smpp_esme *esme, struct msgb *msg) if (!(esme->bind_flags & ESME_BIND_TX)) { submit_r.command_status = ESME_RINVBNDSTS; + destroy_tlv(submit.tlv); return PACK_AND_SEND(esme->esme, &submit_r); } @@ -703,6 +704,7 @@ static int smpp_handle_submit(struct smpp_esme *esme, struct msgb *msg) INIT_RESP(SUBMIT_SM_RESP, &submit_r, &submit); rc = handle_smpp_submit(esme, &submit, &submit_r); + destroy_tlv(submit.tlv); if (rc == 0) return PACK_AND_SEND(esme->esme, &submit_r); |