aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2019-11-12 06:45:48 +0100
committerHarald Welte <laforge@osmocom.org>2019-11-12 17:33:44 +0100
commit1b3fb63b5f386f242caf4c04da85d5467944a44e (patch)
treebd6476ad7d776b6e6fee58036ceba8fe0852d90f
parent3450737d7df22df19980232ef8f854b1d24b0d06 (diff)
ccid_device: Fix memory leaks in ccid_handle_out() error paths
-rw-r--r--ccid_common/ccid_device.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ccid_common/ccid_device.c b/ccid_common/ccid_device.c
index 049b1cf..8183b16 100644
--- a/ccid_common/ccid_device.c
+++ b/ccid_common/ccid_device.c
@@ -644,6 +644,7 @@ int ccid_handle_out(struct ccid_instance *ci, struct msgb *msg)
if (len < sizeof(*ch)) {
/* FIXME */
+ msgb_free(msg);
return -1;
}
@@ -652,6 +653,7 @@ int ccid_handle_out(struct ccid_instance *ci, struct msgb *msg)
if (!cs) {
LOGPCI(ci, LOGL_ERROR, "Invalid bSlot %u\n", ch->bSlot);
resp = gen_err_resp(ch->bMessageType, ch->bSlot, CCID_ICC_STATUS_NO_ICC, ch->bSeq, 5);
+ msgb_free(msg);
return ccid_send(ci, resp);
}
@@ -661,6 +663,7 @@ int ccid_handle_out(struct ccid_instance *ci, struct msgb *msg)
/* FIXME: ABORT logic as per section 5.3.1 of CCID Spec v1.1 */
resp = gen_err_resp(ch->bMessageType, ch->bSlot, get_icc_status(cs), ch->bSeq,
CCID_ERR_CMD_SLOT_BUSY);
+ msgb_free(msg);
return ccid_send(ci, resp);
}