From: Paul Fertser Date: Fri, 24 Apr 2015 14:09:14 +0000 (+0300) Subject: jtag/drivers/ti_icdi: do not segfault when adapter can't be opened X-Git-Tag: v0.9.0-rc1~2 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=1da15d5bff10bda87df338d9ea2addcf3799b1fb;p=openocd jtag/drivers/ti_icdi: do not segfault when adapter can't be opened Change-Id: Id3af8dfd18b13947bca4f3c89c2516ccbcef60b6 Signed-off-by: Paul Fertser Reviewed-on: http://openocd.zylin.com/2742 Tested-by: jenkins --- diff --git a/src/jtag/drivers/ti_icdi_usb.c b/src/jtag/drivers/ti_icdi_usb.c index 53abbfb4..ac456623 100644 --- a/src/jtag/drivers/ti_icdi_usb.c +++ b/src/jtag/drivers/ti_icdi_usb.c @@ -654,6 +654,9 @@ static int icdi_usb_close(void *handle) { struct icdi_usb_handle_s *h = handle; + if (!h) + return ERROR_OK; + if (h->usb_dev) libusb_close(h->usb_dev);