Date: Sat, 3 Feb 2007 15:30:39 +0100 (CET) From: Antoine Brodin <antoine.brodin@laposte.net> To: FreeBSD-gnats-submit@FreeBSD.org Subject: usb/108719: [patch] Plug a few memory leaks in sys/dev/usb Message-ID: <200702031430.l13EUdQB034892@peanut.dreadbsd.org> Resent-Message-ID: <200702031440.l13EeH51027609@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 108719 >Category: usb >Synopsis: [patch] Plug a few memory leaks in sys/dev/usb >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-usb >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Sat Feb 03 14:40:16 GMT 2007 >Closed-Date: >Last-Modified: >Originator: Antoine Brodin >Release: FreeBSD 7.0-CURRENT i386 >Organization: none >Environment: System: FreeBSD barton.dreadbsd.org 7.0-CURRENT FreeBSD 7.0-CURRENT #0: Sun Jan 28 12:17:13 CET 2007 antoine@barton.dreadbsd.org:/usr/obj/usr/src/sys/BARTON i386 >Description: There are a few memory leaks in /sys/dev/usb/ Patch is attached. >How-To-Repeat: >Fix: --- sysdevusb.diff begins here --- Index: usb/uhub.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/uhub.c,v retrieving revision 1.72 diff -u -p -r1.72 uhub.c --- usb/uhub.c 7 Sep 2006 00:06:41 -0000 1.72 +++ usb/uhub.c 28 Jan 2007 17:06:03 -0000 @@ -362,6 +362,7 @@ USB_ATTACH(uhub) /* The usual exploration will finish the setup. */ sc->sc_running = 1; + free(devinfo, M_TEMP); USB_ATTACH_SUCCESS_RETURN; Index: usb/uipaq.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/uipaq.c,v retrieving revision 1.1 diff -u -p -r1.1 uipaq.c --- usb/uipaq.c 28 Jan 2007 11:56:14 -0000 1.1 +++ usb/uipaq.c 28 Jan 2007 13:43:36 -0000 @@ -186,7 +186,6 @@ USB_ATTACH(uipaq) usbd_devinfo(dev, 0, devinfop); printf("%s: %s\n", devname, devinfop); - free(devinfop, M_USBDEV); sc->sc_flags = uipaq_lookup(uaa->vendor, uaa->product)->uv_flags; @@ -225,13 +224,14 @@ USB_ATTACH(uipaq) } ucom_attach(&sc->sc_ucom); - - + free(devinfop, M_USBDEV); + USB_ATTACH_SUCCESS_RETURN; bad: DPRINTF(("uipaq_attach: ATTACH ERROR\n")); ucom->sc_dying = 1; + free(devinfop, M_USBDEV); USB_ATTACH_ERROR_RETURN; } Index: usb/usb_subr.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/usb_subr.c,v retrieving revision 1.87 diff -u -p -r1.87 usb_subr.c --- usb/usb_subr.c 3 Oct 2006 01:13:26 -0000 1.87 +++ usb/usb_subr.c 28 Jan 2007 17:06:27 -0000 @@ -944,6 +944,7 @@ usbd_probe_and_attach(device_t parent, u } uaap = malloc(sizeof(uaa), M_USB, M_NOWAIT); if (uaap == NULL) { + free(devinfo, M_USB); return (USBD_NOMEM); } device_set_ivars(bdev, uaap); @@ -987,6 +988,7 @@ usbd_probe_and_attach(device_t parent, u *uaap = uaa; usbd_devinfo(dev, 1, devinfo); device_set_desc_copy(bdev, devinfo); + free(devinfo, M_USB); dv = USB_DO_ATTACH(dev, bdev, parent, &uaa, usbd_print, usbd_submatch); if (dv != NULL) return (USBD_NORMAL_COMPLETION); Index: usb/uvisor.c =================================================================== RCS file: /home/ncvs/src/sys/dev/usb/uvisor.c,v retrieving revision 1.28 diff -u -p -r1.28 uvisor.c --- usb/uvisor.c 7 Sep 2006 00:06:42 -0000 1.28 +++ usb/uvisor.c 28 Jan 2007 13:43:00 -0000 @@ -377,12 +377,14 @@ USB_ATTACH(uvisor) DPRINTF(("uvisor: in=0x%x out=0x%x\n", ucom->sc_bulkin_no, ucom->sc_bulkout_no)); ucom_attach(&sc->sc_ucom); + free(devinfo, M_USBDEV); USB_ATTACH_SUCCESS_RETURN; bad: DPRINTF(("uvisor_attach: ATTACH ERROR\n")); ucom->sc_dying = 1; + free(devinfo, M_USBDEV); USB_ATTACH_ERROR_RETURN; } --- sysdevusb.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200702031430.l13EUdQB034892>