From 113a421228182698cb77825e3dddaadf1be297c3 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Sun, 27 Dec 2015 14:33:17 -0800 Subject: ftdi: fix memory leak on error Found by cppcheck. Minor memory leak if usb_reset fails Signed-off-by: Stephen Hemminger Signed-off-by: Dirk Hohndel --- subsurface-core/serial_ftdi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/subsurface-core/serial_ftdi.c b/subsurface-core/serial_ftdi.c index cbac026cf..ff1335171 100644 --- a/subsurface-core/serial_ftdi.c +++ b/subsurface-core/serial_ftdi.c @@ -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; } -- cgit v1.2.3-70-g09d2