diff --git a/sys/dev/usb/uhid.c b/sys/dev/usb/uhid.c index 869e94ecd7b1..f233e17ae821 100644 --- a/sys/dev/usb/uhid.c +++ b/sys/dev/usb/uhid.c @@ -230,8 +230,6 @@ USB_ATTACH(uhid) if (err) { printf("%s: no report descriptor\n", USBDEVNAME(sc->sc_dev)); sc->sc_dying = 1; - if (desc != NULL) - free(desc, M_USBDEV); USB_ATTACH_ERROR_RETURN; } diff --git a/sys/dev/usb/usbdi_util.c b/sys/dev/usb/usbdi_util.c index ff48fd7d56a6..3c5b10408fd0 100644 --- a/sys/dev/usb/usbdi_util.c +++ b/sys/dev/usb/usbdi_util.c @@ -460,6 +460,7 @@ usbd_alloc_report_desc(ifc, descp, sizep, mem) *sizep, *descp); if (err) { free(*descp, mem); + *descp = NULL; return (err); } return (USBD_NORMAL_COMPLETION);