diff --git a/examples/mifare-classic-format.c b/examples/mifare-classic-format.c index 0a703a5..1de5e3c 100644 --- a/examples/mifare-classic-format.c +++ b/examples/mifare-classic-format.c @@ -168,6 +168,8 @@ main(int argc, char *argv[]) nfc_context *context; nfc_init (&context); + if (context == NULL) + errx(EXIT_FAILURE, "Unable to init libnfc (malloc)"); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/examples/mifare-classic-read-ndef.c b/examples/mifare-classic-read-ndef.c index 891ffb9..ca20926 100644 --- a/examples/mifare-classic-read-ndef.c +++ b/examples/mifare-classic-read-ndef.c @@ -117,6 +117,8 @@ main(int argc, char *argv[]) nfc_context *context; nfc_init (&context); + if (context == NULL) + errx(EXIT_FAILURE, "Unable to init libnfc (malloc)"); device_count= nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/examples/mifare-classic-write-ndef.c b/examples/mifare-classic-write-ndef.c index c711c3f..f32eb79 100644 --- a/examples/mifare-classic-write-ndef.c +++ b/examples/mifare-classic-write-ndef.c @@ -197,6 +197,8 @@ main(int argc, char *argv[]) nfc_context *context; nfc_init (&context); + if (context == NULL) + errx(EXIT_FAILURE, "Unable to init libnfc (malloc)"); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/examples/mifare-desfire-access.c b/examples/mifare-desfire-access.c index 63046b9..3c38c73 100644 --- a/examples/mifare-desfire-access.c +++ b/examples/mifare-desfire-access.c @@ -43,6 +43,8 @@ main(int argc, char *argv[]) nfc_context *context; nfc_init (&context); + if (context == NULL) + errx(EXIT_FAILURE, "Unable to init libnfc (malloc)"); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/examples/mifare-desfire-create-ndef.c b/examples/mifare-desfire-create-ndef.c index a652da8..e95c860 100644 --- a/examples/mifare-desfire-create-ndef.c +++ b/examples/mifare-desfire-create-ndef.c @@ -98,6 +98,8 @@ main(int argc, char *argv[]) nfc_context *context; nfc_init (&context); + if (context == NULL) + errx(EXIT_FAILURE, "Unable to init libnfc (malloc)"); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/examples/mifare-desfire-ev1-configure-ats.c b/examples/mifare-desfire-ev1-configure-ats.c index 1783c73..c7e71a3 100644 --- a/examples/mifare-desfire-ev1-configure-ats.c +++ b/examples/mifare-desfire-ev1-configure-ats.c @@ -91,6 +91,8 @@ main(int argc, char *argv[]) nfc_context *context; nfc_init (&context); + if (context == NULL) + errx(EXIT_FAILURE, "Unable to init libnfc (malloc)"); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/examples/mifare-desfire-ev1-configure-default-key.c b/examples/mifare-desfire-ev1-configure-default-key.c index fa4174e..462f9a8 100644 --- a/examples/mifare-desfire-ev1-configure-default-key.c +++ b/examples/mifare-desfire-ev1-configure-default-key.c @@ -77,6 +77,8 @@ main(int argc, char *argv[]) nfc_context *context; nfc_init (&context); + if (context == NULL) + errx(EXIT_FAILURE, "Unable to init libnfc (malloc)"); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/examples/mifare-desfire-ev1-configure-random-uid.c b/examples/mifare-desfire-ev1-configure-random-uid.c index d93d8ab..65e23e5 100644 --- a/examples/mifare-desfire-ev1-configure-random-uid.c +++ b/examples/mifare-desfire-ev1-configure-random-uid.c @@ -87,6 +87,8 @@ main(int argc, char *argv[]) nfc_context *context; nfc_init (&context); + if (context == NULL) + errx(EXIT_FAILURE, "Unable to init libnfc (malloc)"); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/examples/mifare-desfire-format.c b/examples/mifare-desfire-format.c index 4baa5db..e4271b8 100644 --- a/examples/mifare-desfire-format.c +++ b/examples/mifare-desfire-format.c @@ -87,6 +87,8 @@ main(int argc, char *argv[]) nfc_context *context; nfc_init (&context); + if (context == NULL) + errx(EXIT_FAILURE, "Unable to init libnfc (malloc)"); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/examples/mifare-desfire-info.c b/examples/mifare-desfire-info.c index a2db8e2..fc9172f 100644 --- a/examples/mifare-desfire-info.c +++ b/examples/mifare-desfire-info.c @@ -41,6 +41,8 @@ main(int argc, char *argv[]) nfc_context *context; nfc_init (&context); + if (context == NULL) + errx(EXIT_FAILURE, "Unable to init libnfc (malloc)"); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/examples/mifare-desfire-read-ndef.c b/examples/mifare-desfire-read-ndef.c index f7fedd5..d32372b 100644 --- a/examples/mifare-desfire-read-ndef.c +++ b/examples/mifare-desfire-read-ndef.c @@ -126,6 +126,8 @@ main(int argc, char *argv[]) nfc_context *context; nfc_init (&context); + if (context == NULL) + errx(EXIT_FAILURE, "Unable to init libnfc (malloc)"); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/examples/mifare-desfire-write-ndef.c b/examples/mifare-desfire-write-ndef.c index 0082f78..70ce5c5 100644 --- a/examples/mifare-desfire-write-ndef.c +++ b/examples/mifare-desfire-write-ndef.c @@ -155,6 +155,8 @@ main(int argc, char *argv[]) nfc_context *context; nfc_init (&context); + if (context == NULL) + errx(EXIT_FAILURE, "Unable to init libnfc (malloc)"); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/examples/mifare-ultralight-info.c b/examples/mifare-ultralight-info.c index f9ca9a6..b3793af 100644 --- a/examples/mifare-ultralight-info.c +++ b/examples/mifare-ultralight-info.c @@ -38,6 +38,8 @@ main (int argc, char *argv[]) nfc_context *context; nfc_init (&context); + if (context == NULL) + errx(EXIT_FAILURE, "Unable to init libnfc (malloc)"); device_count = nfc_list_devices (context, devices, sizeof (devices) / sizeof (*devices)); if (device_count <= 0) diff --git a/test/mifare_classic_fixture.c b/test/mifare_classic_fixture.c index 828c5f2..2e16d88 100644 --- a/test/mifare_classic_fixture.c +++ b/test/mifare_classic_fixture.c @@ -35,7 +35,8 @@ cut_setup (void) nfc_connstring devices[8]; size_t device_count; - nfc_init(&context); + nfc_init (&context); + cut_assert_not_null (context, cut_message ("Unable to init libnfc (malloc)")); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/test/mifare_desfire_ev1_fixture.c b/test/mifare_desfire_ev1_fixture.c index 97fb03a..dd49e7f 100644 --- a/test/mifare_desfire_ev1_fixture.c +++ b/test/mifare_desfire_ev1_fixture.c @@ -36,6 +36,7 @@ cut_setup (void) size_t device_count; nfc_init (&context); + cut_assert_not_null (context, cut_message ("Unable to init libnfc (malloc)")); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/test/mifare_desfire_fixture.c b/test/mifare_desfire_fixture.c index 4985e65..2714cd8 100644 --- a/test/mifare_desfire_fixture.c +++ b/test/mifare_desfire_fixture.c @@ -35,7 +35,8 @@ cut_setup (void) nfc_connstring devices[8]; size_t device_count; - nfc_init(&context); + nfc_init (&context); + cut_assert_not_null (context, cut_message ("Unable to init libnfc (malloc)")); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0) diff --git a/test/mifare_ultralight_fixture.c b/test/mifare_ultralight_fixture.c index 6a21101..a89a9bb 100644 --- a/test/mifare_ultralight_fixture.c +++ b/test/mifare_ultralight_fixture.c @@ -35,7 +35,8 @@ cut_setup (void) nfc_connstring devices[8]; size_t device_count; - nfc_init(&context); + nfc_init (&context); + cut_assert_not_null (context, cut_message ("Unable to init libnfc (malloc)")); device_count = nfc_list_devices (context, devices, 8); if (device_count <= 0)