Commit c1372a00 authored by Philippe Teuwen's avatar Philippe Teuwen

uart drivers: fix missing free(ndd.port)

parent 77838b89
......@@ -549,11 +549,13 @@ acr122s_open(const nfc_context *context, const nfc_connstring connstring)
pnd = nfc_device_new(context, connstring);
if (!pnd) {
perror("malloc");
free(ndd.port);
acr122s_close(pnd);
return NULL;
}
pnd->driver = &acr122s_driver;
strcpy(pnd->name, ACR122S_DRIVER_NAME);
free(ndd.port);
pnd->driver_data = malloc(sizeof(struct acr122s_data));
if (!pnd->driver_data) {
......
......@@ -240,11 +240,11 @@ arygon_open(const nfc_context *context, const nfc_connstring connstring)
return NULL;
}
snprintf(pnd->name, sizeof(pnd->name), "%s:%s", ARYGON_DRIVER_NAME, ndd.port);
free(ndd.port);
pnd->driver_data = malloc(sizeof(struct arygon_data));
if (!pnd->driver_data) {
perror("malloc");
free(ndd.port);
return NULL;
}
DRIVER_DATA(pnd)->port = sp;
......@@ -262,7 +262,6 @@ arygon_open(const nfc_context *context, const nfc_connstring connstring)
#ifndef WIN32
// pipe-based abort mecanism
if (pipe(DRIVER_DATA(pnd)->iAbortFds) < 0) {
free(ndd.port);
return NULL;
}
#else
......
......@@ -212,11 +212,11 @@ pn532_uart_open(const nfc_context *context, const nfc_connstring connstring)
return NULL;
}
snprintf(pnd->name, sizeof(pnd->name), "%s:%s", PN532_UART_DRIVER_NAME, ndd.port);
free(ndd.port);
pnd->driver_data = malloc(sizeof(struct pn532_uart_data));
if (!pnd->driver_data) {
perror("malloc");
free(ndd.port);
return NULL;
}
DRIVER_DATA(pnd)->port = sp;
......@@ -235,7 +235,6 @@ pn532_uart_open(const nfc_context *context, const nfc_connstring connstring)
#ifndef WIN32
// pipe-based abort mecanism
if (pipe(DRIVER_DATA(pnd)->iAbortFds) < 0) {
free(ndd.port);
return NULL;
}
#else
......@@ -246,7 +245,6 @@ pn532_uart_open(const nfc_context *context, const nfc_connstring connstring)
if (pn53x_check_communication(pnd) < 0) {
nfc_perror(pnd, "pn53x_check_communication");
pn532_uart_close(pnd);
free(ndd.port);
return NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment