From 6fb61d3c1e5e1fcd97d4ef210d59fc63a4e1fd94 Mon Sep 17 00:00:00 2001 From: Unknown Date: Tue, 30 Jun 2020 17:19:24 +0200 Subject: [PATCH] error handling --- utils/nfc-mfclassic.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/utils/nfc-mfclassic.c b/utils/nfc-mfclassic.c index 7fa16d7..244af45 100644 --- a/utils/nfc-mfclassic.c +++ b/utils/nfc-mfclassic.c @@ -822,9 +822,17 @@ main(int argc, const char *argv[]) } printf("Done.\n"); fclose(pfDump); + } else { + nfc_close(pnd); + nfc_exit(context); + exit(EXIT_FAILURE); } } else if (atAction == ACTION_WRITE) { - write_card(unlock); + if (!write_card(unlock)) { + nfc_close(pnd); + nfc_exit(context); + exit(EXIT_FAILURE); + } } nfc_close(pnd);