From 7f6ccd3926edb78bd23dd90ec59c7036bdff964a Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Fri, 8 Jan 2016 15:28:24 +0100 Subject: [PATCH] FIX: coverty scan defects. - bigbuf.c is comparision correct (iLen versus numofparity) - cmdhfepa.c resourceleak, add a call to free - cipherutils.c resourceleak, added calls to free --- armsrc/BigBuf.c | 2 +- client/cmdhfepa.c | 2 +- client/loclass/cipherutils.c | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/armsrc/BigBuf.c b/armsrc/BigBuf.c index 64ad91ff..f3f23ddc 100644 --- a/armsrc/BigBuf.c +++ b/armsrc/BigBuf.c @@ -184,7 +184,7 @@ bool RAMFUNC LogTrace(const uint8_t *btBytes, uint16_t iLen, uint32_t timestamp_ traceLen += iLen; // parity bytes - if (iLen != 0) { + if (num_paritybytes != 0) { if (parity != NULL) { memcpy(trace + traceLen, parity, num_paritybytes); } else { diff --git a/client/cmdhfepa.c b/client/cmdhfepa.c index e9c63f20..ed903cf6 100644 --- a/client/cmdhfepa.c +++ b/client/cmdhfepa.c @@ -58,13 +58,13 @@ int CmdHFEPACollectPACENonces(const char *Cmd) } // print nonce PrintAndLog("Length: %d, Nonce: %s", nonce_length, nonce); + free(nonce); } if (i < n - 1) { sleep(d); } } PrintAndLog("End: %u", time(NULL)); - return 1; } diff --git a/client/loclass/cipherutils.c b/client/loclass/cipherutils.c index 83b3c9fa..9a8256bb 100644 --- a/client/loclass/cipherutils.c +++ b/client/loclass/cipherutils.c @@ -171,6 +171,7 @@ void printarr(char * name, uint8_t* arr, int len) } cx += snprintf(output+cx,outsize-cx,"};"); prnlog(output); + free(output); } void printvar(char * name, uint8_t* arr, int len) @@ -188,6 +189,7 @@ void printvar(char * name, uint8_t* arr, int len) } prnlog(output); + free(output); } void printarr_human_readable(char * title, uint8_t* arr, int len) -- 2.39.5