aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc
diff options
context:
space:
mode:
authorPablo Neira Ayuso <pablo@gnumonks.org>2017-08-07 14:01:01 +0100
committerPablo Neira Ayuso <pablo@gnumonks.org>2017-08-08 10:20:20 +0200
commit18ca1ce2ea9f0c353e6886a9d05c61238bba9dc6 (patch)
treef7796e0f541318333b66486a298147a85155d450 /openbsc
parent448ad7143b70bac8cf92beb074b8a5f889c6d00b (diff)
libmsc: do not leak pending SMPP command object on error path
Make sure the SMPP command object is released on errors. Change-Id: I474584425d23fb379a9d71b33e29ac0e24f01e61
Diffstat (limited to 'openbsc')
-rw-r--r--openbsc/src/libmsc/smpp_openbsc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/openbsc/src/libmsc/smpp_openbsc.c b/openbsc/src/libmsc/smpp_openbsc.c
index f7d144191..36ad0a2ef 100644
--- a/openbsc/src/libmsc/smpp_openbsc.c
+++ b/openbsc/src/libmsc/smpp_openbsc.c
@@ -517,7 +517,7 @@ void smpp_cmd_ack(struct osmo_smpp_cmd *cmd)
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 @@ void smpp_cmd_ack(struct osmo_smpp_cmd *cmd)
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 @@ void smpp_cmd_err(struct osmo_smpp_cmd *cmd, uint32_t status)
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 @@ void smpp_cmd_err(struct osmo_smpp_cmd *cmd, uint32_t status)
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);
}