From 0892708119735d1f3720700a8334a35bc37706c0 Mon Sep 17 00:00:00 2001 From: Alexis Green Date: Tue, 2 Aug 2016 13:57:44 -0700 Subject: [PATCH] FIX: CoverityScan 123465 - Resource leak --- client/cmdhflegic.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/client/cmdhflegic.c b/client/cmdhflegic.c index 731cead1..d55ea98d 100644 --- a/client/cmdhflegic.c +++ b/client/cmdhflegic.c @@ -575,6 +575,9 @@ int CmdLegicCalcCrc8(const char *Cmd){ switch(param_getchar(Cmd, cmdp)) { case 'b': case 'B': + // it's possible for user to accidentally enter "b" parameter + // more than once - we have to clean previous malloc + if (data) free(data); data = malloc(len); if ( data == NULL ) { PrintAndLog("Can't allocate memory. exiting"); -- 2.39.2