]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhfmf.c
More coverity fixes
[proxmark3-svn] / client / cmdhfmf.c
index 80d93a46659e74950b4aa68e20488588e4a28534..bdb0e7e744f93848541e0d941214dcce34bfc0b1 100644 (file)
@@ -667,12 +667,15 @@ int CmdHF14AMfRestore(const char *Cmd)
        }\r
        if ((fkeys = fopen("dumpkeys.bin","rb")) == NULL) {\r
                PrintAndLog("Could not find file dumpkeys.bin");\r
+               fclose(fdump);\r
                return 1;\r
        }\r
        \r
        for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {\r
                if (fread(keyA[sectorNo], 1, 6, fkeys) == 0) {\r
                        PrintAndLog("File reading error (dumpkeys.bin).");\r
+                       fclose(fdump);\r
+                       fclose(fkeys);\r
                        return 2;\r
                }\r
        }\r
@@ -680,9 +683,12 @@ int CmdHF14AMfRestore(const char *Cmd)
        for (sectorNo = 0; sectorNo < numSectors; sectorNo++) {\r
                if (fread(keyB[sectorNo], 1, 6, fkeys) == 0) {\r
                        PrintAndLog("File reading error (dumpkeys.bin).");\r
+                       fclose(fdump);\r
+                       fclose(fkeys);\r
                        return 2;\r
                }\r
        }\r
+       fclose(fkeys);\r
 \r
        PrintAndLog("Restoring dumpdata.bin to card");\r
 \r
@@ -693,6 +699,7 @@ int CmdHF14AMfRestore(const char *Cmd)
                        \r
                        if (fread(bldata, 1, 16, fdump) == 0) {\r
                                PrintAndLog("File reading error (dumpdata.bin).");\r
+                               fclose(fdump);\r
                                return 2;\r
                        }\r
                                        \r
@@ -727,7 +734,6 @@ int CmdHF14AMfRestore(const char *Cmd)
        }\r
        \r
        fclose(fdump);\r
-       fclose(fkeys);\r
        return 0;\r
 }\r
 \r
Impressum, Datenschutz