mirror of
https://github.com/nfc-tools/libnfc.git
synced 2026-03-03 06:11:46 +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();
|
||||
|
||||
Reference in New Issue
Block a user