From: Michael Gernoth Date: Sat, 31 Jan 2015 23:57:30 +0000 (+0100) Subject: avoid possible null-pointer dereference in error-path X-Git-Tag: v0.100~14 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/hmcfgusb/commitdiff_plain/325ed7030d39536af863e9c49b5fa04ac0a28d5d?ds=sidebyside avoid possible null-pointer dereference in error-path --- diff --git a/hmcfgusb.c b/hmcfgusb.c index 0e11866..83c9719 100644 --- a/hmcfgusb.c +++ b/hmcfgusb.c @@ -285,8 +285,11 @@ static void LIBUSB_CALL hmcfgusb_interrupt(struct libusb_transfer *transfer) if (err != 0) { fprintf(stderr, "Can't re-submit transfer: %s\n", usb_strerror(err)); libusb_free_transfer(transfer); - cb_data->dev->transfer = NULL; - free(cb_data); + if (cb_data) { + if (cb_data->dev) + cb_data->dev->transfer = NULL; + free(cb_data); + } } }