[PATCH] osmo-msc[master]: libmsc: do not leak pending SMPP command object on error path

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Thu Aug 24 17:41:02 UTC 2017


Review at  https://gerrit.osmocom.org/3632

libmsc: do not leak pending SMPP command object on error path

Make sure the SMPP command object is released on errors.

Change-Id: I474584425d23fb379a9d71b33e29ac0e24f01e61
---
M src/libmsc/smpp_openbsc.c
1 file changed, 6 insertions(+), 5 deletions(-)


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

diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index b3f9bbb..394827b 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -521,7 +521,7 @@
 	conn = connection_for_subscr(cmd->vsub);
 	if (!conn) {
 		LOGP(DSMPP, LOGL_ERROR, "No connection to subscriber anymore\n");
-		return;
+		goto out;
 	}
 
 	trans = trans_find_by_id(conn, GSM48_PDISC_SMS,
@@ -529,10 +529,11 @@
 	if (!trans) {
 		LOGP(DSMPP, LOGL_ERROR, "GSM transaction %u is gone\n",
 		     cmd->sms->gsm411.transaction_id);
-		return;
+		goto out;
 	}
 
 	gsm411_send_rp_ack(trans, cmd->sms->gsm411.msg_ref);
+out:
 	smpp_cmd_free(cmd);
 }
 
@@ -545,7 +546,7 @@
 	conn = connection_for_subscr(cmd->vsub);
 	if (!conn) {
 		LOGP(DSMPP, LOGL_ERROR, "No connection to subscriber anymore\n");
-		return;
+		goto out;
 	}
 
 	trans = trans_find_by_id(conn, GSM48_PDISC_SMS,
@@ -553,14 +554,14 @@
 	if (!trans) {
 		LOGP(DSMPP, LOGL_ERROR, "GSM transaction %u is gone\n",
 		     cmd->sms->gsm411.transaction_id);
-		return;
+		goto out;
 	}
 
 	if (smpp_to_gsm411_err(status, &gsm411_cause) < 0)
 		gsm411_cause = GSM411_RP_CAUSE_MO_NET_OUT_OF_ORDER;
 
 	gsm411_send_rp_error(trans, cmd->sms->gsm411.msg_ref, gsm411_cause);
-
+out:
 	smpp_cmd_free(cmd);
 }
 

-- 
To view, visit https://gerrit.osmocom.org/3632
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I474584425d23fb379a9d71b33e29ac0e24f01e61
Gerrit-PatchSet: 1
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pablo Neira Ayuso <pablo at gnumonks.org>



More information about the gerrit-log mailing list