From cff9e2381d3f963f101723f355ed08f540bfffb4 Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Tue, 2 Jun 2020 11:02:37 +0200 Subject: [PATCH] fix coverity 290268 --- client/src/cmdhfmf.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index 85f390b4b..5c0ae6cb5 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -515,7 +515,6 @@ static char *GenerateFilename(const char *prefix, const char *suffix) { static int32_t initSectorTable(sector_t **src, int32_t items) { - // initialize storage (*src) = calloc(items, sizeof(sector_t)); if (*src == NULL) @@ -3144,6 +3143,7 @@ void readerAttack(sector_t *k_sector, uint8_t k_sectorsCount, nonces_t data, boo if (k_sector == NULL) { int32_t res = initSectorTable(&k_sector, k_sectorsCount); if (res != k_sectorsCount) { + free(k_sector); return; } } @@ -3175,6 +3175,8 @@ void readerAttack(sector_t *k_sector, uint8_t k_sectorsCount, nonces_t data, boo mfEmlSetMem(memBlock, (sector * 4) + 3, 1); } } + + free(k_sector); } static int CmdHF14AMfSim(const char *Cmd) {