diff --git a/src/mfoc.c b/src/mfoc.c index 4f792c0..0cb917d 100644 --- a/src/mfoc.c +++ b/src/mfoc.c @@ -582,6 +582,10 @@ void mf_init(mfreader *r) { // Connect to the first NFC device nfc_init(&context); + if (context == NULL) { + ERR("Unable to init libnfc (malloc)"); + exit(EXIT_FAILURE); + } r->pdi = nfc_open(context, NULL); if (!r->pdi) { printf("No NFC device found.\n");