fix coverity 290268

This commit is contained in:
iceman1001 2020-06-02 11:02:37 +02:00
commit cff9e2381d

View file

@ -515,7 +515,6 @@ static char *GenerateFilename(const char *prefix, const char *suffix) {
static int32_t initSectorTable(sector_t **src, int32_t items) { static int32_t initSectorTable(sector_t **src, int32_t items) {
// initialize storage
(*src) = calloc(items, sizeof(sector_t)); (*src) = calloc(items, sizeof(sector_t));
if (*src == NULL) 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) { if (k_sector == NULL) {
int32_t res = initSectorTable(&k_sector, k_sectorsCount); int32_t res = initSectorTable(&k_sector, k_sectorsCount);
if (res != k_sectorsCount) { if (res != k_sectorsCount) {
free(k_sector);
return; 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); mfEmlSetMem(memBlock, (sector * 4) + 3, 1);
} }
} }
free(k_sector);
} }
static int CmdHF14AMfSim(const char *Cmd) { static int CmdHF14AMfSim(const char *Cmd) {