Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linux_get_parent_info: Check for NULL priv->sysfs_dir before strcmp #129

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 5 additions & 3 deletions libusb/os/linux_usbfs.c
Expand Up @@ -1034,9 +1034,11 @@ static int linux_get_parent_info(struct libusb_device *dev, const char *sysfs_di
usbi_mutex_lock(&ctx->usb_devs_lock);
list_for_each_entry(it, &ctx->usb_devs, list, struct libusb_device) {
struct linux_device_priv *priv = _device_priv(it);
if (0 == strcmp (priv->sysfs_dir, parent_sysfs_dir)) {
dev->parent_dev = libusb_ref_device(it);
break;
if (priv->sysfs_dir) {
if (0 == strcmp (priv->sysfs_dir, parent_sysfs_dir)) {
dev->parent_dev = libusb_ref_device(it);
break;
}
}
}
usbi_mutex_unlock(&ctx->usb_devs_lock);
Expand Down