diff --git a/examples/pn53x-tamashell.c b/examples/pn53x-tamashell.c index f517610..b161347 100644 --- a/examples/pn53x-tamashell.c +++ b/examples/pn53x-tamashell.c @@ -91,12 +91,18 @@ int main(int argc, const char *argv[]) if (pnd == NULL) { ERR("%s", "Unable to open NFC device."); + if (input != NULL) { + fclose(input); + } return EXIT_FAILURE; } printf("NFC reader: %s opened\n", nfc_device_get_name(pnd)); if (nfc_initiator_init(pnd) < 0) { nfc_perror(pnd, "nfc_initiator_init"); + if (input != NULL) { + fclose(input); + } exit(EXIT_FAILURE); } diff --git a/utils/nfc-mfultralight.c b/utils/nfc-mfultralight.c index 0f3cd4a..1113a5a 100644 --- a/utils/nfc-mfultralight.c +++ b/utils/nfc-mfultralight.c @@ -261,6 +261,7 @@ main(int argc, const char *argv[]) } if (fwrite(&mtDump, 1, sizeof(mtDump), pfDump) != sizeof(mtDump)) { printf("Could not write to file: %s\n", argv[2]); + fclose(pfDump); return EXIT_FAILURE; } fclose(pfDump);