ftdi: fix memory leak on error

Found by cppcheck. Minor memory leak if usb_reset fails

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Stephen Hemminger 2015-12-27 14:33:17 -08:00 committed by Dirk Hohndel
parent 7a42215067
commit 113a421228

View file

@ -218,6 +218,7 @@ static dc_status_t serial_ftdi_open (serial_t **out, dc_context_t *context, cons
}
if (ftdi_usb_reset(ftdi_ctx)) {
free(device);
ERROR (context, "%s", ftdi_get_error_string(ftdi_ctx));
return DC_STATUS_IO;
}