[MERGED] openbsc[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/.

Pablo Neira Ayuso gerrit-no-reply at lists.osmocom.org
Wed Aug 9 10:14:09 UTC 2017


Pablo Neira Ayuso has submitted this change and it was merged.

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


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 openbsc/src/libmsc/smpp_openbsc.c
1 file changed, 6 insertions(+), 5 deletions(-)

Approvals:
  Neels Hofmeyr: Looks good to me, approved
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/openbsc/src/libmsc/smpp_openbsc.c b/openbsc/src/libmsc/smpp_openbsc.c
index f7d1441..36ad0a2 100644
--- a/openbsc/src/libmsc/smpp_openbsc.c
+++ b/openbsc/src/libmsc/smpp_openbsc.c
@@ -517,7 +517,7 @@
 	conn = connection_for_subscr(cmd->subscr);
 	if (!conn) {
 		LOGP(DSMPP, LOGL_ERROR, "No connection to subscriber anymore\n");
-		return;
+		goto out;
 	}
 
 	trans = trans_find_by_id(conn, GSM48_PDISC_SMS,
@@ -525,10 +525,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);
 }
 
@@ -541,7 +542,7 @@
 	conn = connection_for_subscr(cmd->subscr);
 	if (!conn) {
 		LOGP(DSMPP, LOGL_ERROR, "No connection to subscriber anymore\n");
-		return;
+		goto out;
 	}
 
 	trans = trans_find_by_id(conn, GSM48_PDISC_SMS,
@@ -549,14 +550,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/3423
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I474584425d23fb379a9d71b33e29ac0e24f01e61
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Pablo Neira Ayuso <pablo at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Holger Freyther <holger at freyther.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: Keith Whyte <keith at rhizomatica.org>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pablo Neira Ayuso <pablo at gnumonks.org>



More information about the gerrit-log mailing list