nfc_init() return rather than exit on malloc error, examples fixed accordingly
This commit is contained in:
parent
ae6062e5ba
commit
73b5c9d0af
22 changed files with 92 additions and 9 deletions
|
|
@ -36,6 +36,10 @@ main(int argc, const char *argv[])
|
|||
|
||||
// Initialize libnfc and set the nfc_context
|
||||
nfc_init(&context);
|
||||
if (context == NULL) {
|
||||
warnx("Unable to init libnfc (malloc)\n");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// Display libnfc version
|
||||
const char *acLibnfcVersion = nfc_version();
|
||||
|
|
|
|||
|
|
@ -28,6 +28,10 @@ main(int argc, const char *argv[])
|
|||
|
||||
// Initialize libnfc and set the nfc_context
|
||||
nfc_init(&context);
|
||||
if (context == NULL) {
|
||||
ERR("Unable to init libnfc (malloc)");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
// Display libnfc version
|
||||
const char *acLibnfcVersion = nfc_version();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue