]> git.zerfleddert.de Git - hmcfgusb/commitdiff
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 0e118661fa7007397f19c52b647f96299c9c1e22..83c9719b04b0d71e7324343a4aa75e7f147d3f87 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