]> git.zerfleddert.de Git - proxmark3-svn/commitdiff
FIX: CoverityScan 123465 - Resource leak
authorAlexis Green <alexis@cessp.it>
Tue, 2 Aug 2016 20:57:44 +0000 (13:57 -0700)
committerAlexis Green <alexis@cessp.it>
Tue, 2 Aug 2016 20:57:44 +0000 (13:57 -0700)
client/cmdhflegic.c

index 731cead1097a5f80b0c56c104bfe81346b75b702..d55ea98d8907deccbe111a5a8d95e326425c2077 100644 (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");
Impressum, Datenschutz