From owner-freebsd-usb@FreeBSD.ORG Sat Feb 3 14:40:17 2007 Return-Path: X-Original-To: freebsd-usb@hub.freebsd.org Delivered-To: freebsd-usb@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 9809716A402 for ; Sat, 3 Feb 2007 14:40:17 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [69.147.83.40]) by mx1.freebsd.org (Postfix) with ESMTP id 757B013C48E for ; Sat, 3 Feb 2007 14:40:17 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id l13EeHRk027613 for ; Sat, 3 Feb 2007 14:40:17 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id l13EeH51027609; Sat, 3 Feb 2007 14:40:17 GMT (envelope-from gnats) Resent-Date: Sat, 3 Feb 2007 14:40:17 GMT Resent-Message-Id: <200702031440.l13EeH51027609@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-usb@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Antoine Brodin Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E60A816A402 for ; Sat, 3 Feb 2007 14:30:43 +0000 (UTC) (envelope-from antoine@peanut.dreadbsd.org) Received: from peanut.dreadbsd.org (peanut.dreadbsd.org [82.67.196.50]) by mx1.freebsd.org (Postfix) with ESMTP id 4B38C13C4A7 for ; Sat, 3 Feb 2007 14:30:42 +0000 (UTC) (envelope-from antoine@peanut.dreadbsd.org) Received: from peanut.dreadbsd.org (localhost [127.0.0.1]) by peanut.dreadbsd.org (8.13.8/8.13.8) with ESMTP id l13EUers034893 for ; Sat, 3 Feb 2007 15:30:40 +0100 (CET) (envelope-from antoine@peanut.dreadbsd.org) Received: (from antoine@localhost) by peanut.dreadbsd.org (8.13.8/8.13.8/Submit) id l13EUdQB034892; Sat, 3 Feb 2007 15:30:39 +0100 (CET) (envelope-from antoine) Message-Id: <200702031430.l13EUdQB034892@peanut.dreadbsd.org> Date: Sat, 3 Feb 2007 15:30:39 +0100 (CET) From: Antoine Brodin To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 Cc: Subject: usb/108719: [patch] Plug a few memory leaks in sys/dev/usb X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Antoine Brodin List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 03 Feb 2007 14:40:17 -0000 >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: