[PATCH 4/6] Slight clean up of the code in gsm340_rx_tpdu() and a fix for an unlikely, but possible memory leak there.

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/OpenBSC@lists.osmocom.org/.

Alexander Chemeris alexander.chemeris at gmail.com
Fri Oct 4 00:42:27 UTC 2013


---
 openbsc/src/libmsc/gsm_04_11.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c
index 2fc250b..e554b74 100644
--- a/openbsc/src/libmsc/gsm_04_11.c
+++ b/openbsc/src/libmsc/gsm_04_11.c
@@ -337,8 +337,8 @@ static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *m
 
 	sms_alphabet = gsm338_get_sms_alphabet(gsms->data_coding_scheme);
 	if (sms_alphabet == 0xffffffff) {
-		sms_free(gsms);
-		return GSM411_RP_CAUSE_MO_NET_OUT_OF_ORDER;
+		rc = GSM411_RP_CAUSE_MO_NET_OUT_OF_ORDER;
+		goto out;
 	}
 
 	switch (sms_vpf) {
@@ -359,7 +359,8 @@ static int gsm340_rx_tpdu(struct gsm_subscriber_connection *conn, struct msgb *m
 	default:
 		LOGP(DLSMS, LOGL_NOTICE,
 		     "SMS Validity period not implemented: 0x%02x\n", sms_vpf);
-		return GSM411_RP_CAUSE_MO_NET_OUT_OF_ORDER;
+		rc = GSM411_RP_CAUSE_MO_NET_OUT_OF_ORDER;
+		goto out;
 	}
 	gsms->user_data_len = *smsp++;
 	if (gsms->user_data_len) {
-- 
1.7.9.5





More information about the OpenBSC mailing list