]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhfmf.c
Code cleanup (#616)
[proxmark3-svn] / client / cmdhfmf.c
index b50d6013dec48a6a68142ec5b2bd36ae827c7898..e2a4ba1e2f09da71decceb0f82ad37f8857655a4 100644 (file)
@@ -726,7 +726,6 @@ int CmdHF14AMfNested(const char *Cmd)
                                                blockNo = i * 4;\r
                                                keyType = j;\r
                                                num_to_bytes(e_sector[i].Key[j], 6, key);\r
                                                blockNo = i * 4;\r
                                                keyType = j;\r
                                                num_to_bytes(e_sector[i].Key[j], 6, key);\r
-                                               \r
                                                keyFound = true;\r
                                                break;\r
                                        }\r
                                                keyFound = true;\r
                                                break;\r
                                        }\r
@@ -737,6 +736,7 @@ int CmdHF14AMfNested(const char *Cmd)
                        // Can't found a key....\r
                        if (!keyFound) {\r
                                PrintAndLog("Can't found any of the known keys.");\r
                        // Can't found a key....\r
                        if (!keyFound) {\r
                                PrintAndLog("Can't found any of the known keys.");\r
+                               free(e_sector);\r
                                return 4;\r
                        }\r
                        PrintAndLog("--auto key. block no:%3d, key type:%c key:%s", blockNo, keyType?'B':'A', sprint_hex(key, 6));\r
                                return 4;\r
                        }\r
                        PrintAndLog("--auto key. block no:%3d, key type:%c key:%s", blockNo, keyType?'B':'A', sprint_hex(key, 6));\r
@@ -1187,7 +1187,10 @@ int CmdHF14AMfChk(const char *Cmd)
 \r
        // initialize storage for found keys\r
        e_sector = calloc(SectorsCnt, sizeof(sector_t));\r
 \r
        // initialize storage for found keys\r
        e_sector = calloc(SectorsCnt, sizeof(sector_t));\r
-       if (e_sector == NULL) return 1;\r
+       if (e_sector == NULL) {\r
+               free(keyBlock);\r
+               return 1;\r
+       }\r
        for (uint8_t keyAB = 0; keyAB < 2; keyAB++) {\r
                for (uint16_t sectorNo = 0; sectorNo < SectorsCnt; sectorNo++) {\r
                        e_sector[sectorNo].Key[keyAB] = 0xffffffffffff;\r
        for (uint8_t keyAB = 0; keyAB < 2; keyAB++) {\r
                for (uint16_t sectorNo = 0; sectorNo < SectorsCnt; sectorNo++) {\r
                        e_sector[sectorNo].Key[keyAB] = 0xffffffffffff;\r
@@ -2666,11 +2669,9 @@ static command_t CommandTable[] =
 \r
 int CmdHFMF(const char *Cmd)\r
 {\r
 \r
 int CmdHFMF(const char *Cmd)\r
 {\r
-       // flush\r
-       WaitForResponseTimeout(CMD_ACK,NULL,100);\r
-\r
-  CmdsParse(CommandTable, Cmd);\r
-  return 0;\r
+       (void)WaitForResponseTimeout(CMD_ACK,NULL,100);\r
+       CmdsParse(CommandTable, Cmd);\r
+       return 0;\r
 }\r
 \r
 int CmdHelp(const char *Cmd)\r
 }\r
 \r
 int CmdHelp(const char *Cmd)\r
Impressum, Datenschutz