FIX: CoverityScan 123465 - Resource leak

This commit is contained in:
Alexis Green 2016-08-02 13:57:44 -07:00
parent 5147ec6959
commit 0892708119

View file

@ -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");