From 3387ab8dd04749bced2c1962d461ebd80e0c4486 Mon Sep 17 00:00:00 2001 From: mpi Date: Tue, 29 Apr 2014 12:47:33 +0000 Subject: [PATCH] Plug an xfer leak. --- sys/dev/usb/uhidev.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/sys/dev/usb/uhidev.c b/sys/dev/usb/uhidev.c index 205fa8e9270..5f7cd0f968d 100644 --- a/sys/dev/usb/uhidev.c +++ b/sys/dev/usb/uhidev.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uhidev.c,v 1.59 2014/04/24 09:40:28 mpi Exp $ */ +/* $OpenBSD: uhidev.c,v 1.60 2014/04/29 12:47:33 mpi Exp $ */ /* $NetBSD: uhidev.c,v 1.14 2003/03/11 16:44:00 augustss Exp $ */ /* @@ -572,6 +572,10 @@ out1: usbd_free_xfer(sc->sc_owxfer); sc->sc_owxfer = NULL; } + if (sc->sc_ixfer != NULL) { + usbd_free_xfer(sc->sc_ixfer); + sc->sc_ixfer = NULL; + } return (error); } @@ -587,11 +591,20 @@ uhidev_close(struct uhidev *scd) return; DPRINTF(("uhidev_close: close pipe\n")); - if (sc->sc_oxfer != NULL) + if (sc->sc_oxfer != NULL) { usbd_free_xfer(sc->sc_oxfer); + sc->sc_oxfer = NULL; + } - if (sc->sc_owxfer != NULL) + if (sc->sc_owxfer != NULL) { usbd_free_xfer(sc->sc_owxfer); + sc->sc_owxfer = NULL; + } + + if (sc->sc_ixfer != NULL) { + usbd_free_xfer(sc->sc_ixfer); + sc->sc_ixfer = NULL; + } /* Disable interrupts. */ if (sc->sc_opipe != NULL) { -- 2.20.1