Fix crash in libphoto2_port usb module From: Daniel Drake usb_open() will return NULL in some situations, for example, lack of permissions. You'll get a crash if you continue working with that device. Handle that condition appropriately. This was identified by using the new libusb-compat-0.1 with libusb-1.0 at https://bugzilla.novell.com/show_bug.cgi?id=432129 The new setup returns errors from usb_open() on a slightly set of conditions than libusb-0.1 did. However, it doesn't change that this bug also existed (in different circumstances) with libusb-0.1 Index: libgphoto2-2.4.3/libgphoto2_port/usb/libusb.c =================================================================== --- libgphoto2-2.4.3.orig/libgphoto2_port/usb/libusb.c +++ libgphoto2-2.4.3/libgphoto2_port/usb/libusb.c @@ -780,6 +780,9 @@ gp_port_usb_match_mtp_device(struct usb_ #endif devh = usb_open (dev); + if (!devh) + return 0; + /* get string descriptor at 0xEE */ ret = usb_get_descriptor (devh, 0x03, 0xee, buf, sizeof(buf)); if (ret > 0) gp_log_data("get_MS_OSD",buf, ret);