From df96f93d4916ad5f390c1720db4cbd868975199e Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sat, 3 Feb 2007 19:11:09 +0000 Subject: [PATCH] It turns out we were mallocing too early, so move the allocation so we don't leak. --- sys/dev/usb/uipaq.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/sys/dev/usb/uipaq.c b/sys/dev/usb/uipaq.c index b83b7e4a3860..2498b500117e 100644 --- a/sys/dev/usb/uipaq.c +++ b/sys/dev/usb/uipaq.c @@ -159,7 +159,6 @@ uipaq_attach(device_t self) ucom->sc_dev = self; ucom->sc_udev = dev; - devinfop = malloc (1024, M_USBDEV, M_WAITOK); DPRINTFN(10,("\nuipaq_attach: sc=%p\n", sc)); @@ -178,6 +177,11 @@ uipaq_attach(device_t self) goto bad; } + devinfop = malloc (1024, M_USBDEV, M_WAITOK); + if (devinfop == NULL) { + err = ENOMEM; + goto bad; + } usbd_devinfo(dev, 0, devinfop); ucom->sc_dev = self; device_set_desc_copy(self, devinfop);