mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-04-20 13:36:19 +00:00
nfc_init() return rather than exit on malloc error, examples fixed accordingly
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user