avoid possible null-pointer dereference in error-path
authorMichael Gernoth <michael@gernoth.net>
Sat, 31 Jan 2015 23:57:30 +0000 (00:57 +0100)
committerMichael Gernoth <michael@gernoth.net>
Sat, 31 Jan 2015 23:57:30 +0000 (00:57 +0100)
hmcfgusb.c

index 0e11866..83c9719 100644 (file)
@@ -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);
+               }
        }
 }
 
Impressum, Datenschutz