uart drivers: missing pn53x_data_free() on some error handling branches

This commit is contained in:
Philippe Teuwen 2013-03-17 23:57:31 +01:00
parent 5f70bdc699
commit af57df532b
2 changed files with 4 additions and 0 deletions

View file

@ -141,6 +141,7 @@ arygon_scan(const nfc_context *context, nfc_connstring connstrings[], const size
// pipe-based abort mecanism
if (pipe(DRIVER_DATA(pnd)->iAbortFds) < 0) {
uart_close(DRIVER_DATA(pnd)->port);
pn53x_data_free(pnd);
nfc_device_free(pnd);
return 0;
}
@ -271,6 +272,7 @@ arygon_open(const nfc_context *context, const nfc_connstring connstring)
// pipe-based abort mecanism
if (pipe(DRIVER_DATA(pnd)->iAbortFds) < 0) {
uart_close(DRIVER_DATA(pnd)->port);
pn53x_data_free(pnd);
nfc_device_free(pnd);
return NULL;
}

View file

@ -114,6 +114,7 @@ pn532_uart_scan(const nfc_context *context, nfc_connstring connstrings[], const
// pipe-based abort mecanism
if (pipe(DRIVER_DATA(pnd)->iAbortFds) < 0) {
uart_close(DRIVER_DATA(pnd)->port);
pn53x_data_free(pnd);
nfc_device_free(pnd);
return 0;
}
@ -244,6 +245,7 @@ pn532_uart_open(const nfc_context *context, const nfc_connstring connstring)
// pipe-based abort mecanism
if (pipe(DRIVER_DATA(pnd)->iAbortFds) < 0) {
uart_close(DRIVER_DATA(pnd)->port);
pn53x_data_free(pnd);
nfc_device_free(pnd);
return NULL;
}