Otherwise it happens if stlink can not be opened on start.
Change-Id: I7088f10e61508dae230eccfe576a51498c92f5b8
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-on: http://openocd.zylin.com/2550
Tested-by: jenkins
Reviewed-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Spencer Oliver <spen@spen-soft.co.uk>
Reviewed-by: Stian Skjelstad <stian@nixia.no>
}
/** */
-static int stlink_usb_close(void *fd)
+static int stlink_usb_close(void *handle)
{
- struct stlink_usb_handle_s *h = fd;
+ struct stlink_usb_handle_s *h = handle;
- if (h->fd)
+ if (h && h->fd)
jtag_libusb_close(h->fd);
- free(fd);
+ free(h);
return ERROR_OK;
}