From af57df532bb498242ae720a69f467eede911c74d Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sun, 17 Mar 2013 23:57:31 +0100 Subject: [PATCH] uart drivers: missing pn53x_data_free() on some error handling branches --- libnfc/drivers/arygon.c | 2 ++ libnfc/drivers/pn532_uart.c | 2 ++ 2 files changed, 4 insertions(+) diff --git a/libnfc/drivers/arygon.c b/libnfc/drivers/arygon.c index ea04be0..1201529 100644 --- a/libnfc/drivers/arygon.c +++ b/libnfc/drivers/arygon.c @@ -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; } diff --git a/libnfc/drivers/pn532_uart.c b/libnfc/drivers/pn532_uart.c index 510918f..afa07d0 100644 --- a/libnfc/drivers/pn532_uart.c +++ b/libnfc/drivers/pn532_uart.c @@ -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; }