Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/usb from "Just a Normal Person", make sure that we s...



details:   https://anonhg.NetBSD.org/src/rev/74ae766b3319
branches:  trunk
changeset: 792219:74ae766b3319
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Dec 26 15:32:48 2013 +0000

description:
from "Just a Normal Person", make sure that we set things to NULL after
we free them.

diffstat:

 sys/dev/usb/uhidev.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r b4487b099072 -r 74ae766b3319 sys/dev/usb/uhidev.c
--- a/sys/dev/usb/uhidev.c      Thu Dec 26 14:15:29 2013 +0000
+++ b/sys/dev/usb/uhidev.c      Thu Dec 26 15:32:48 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhidev.c,v 1.58 2013/10/05 07:05:01 skrll Exp $        */
+/*     $NetBSD: uhidev.c,v 1.59 2013/12/26 15:32:48 christos Exp $     */
 
 /*
  * Copyright (c) 2001, 2012 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.58 2013/10/05 07:05:01 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhidev.c,v 1.59 2013/12/26 15:32:48 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -604,6 +604,7 @@
        free(sc->sc_ibuf, M_USBDEV);
        mutex_enter(&sc->sc_lock);
        scd->sc_state &= ~UHIDEV_OPEN;
+       sc->sc_ibuf = NULL;
        sc->sc_ipipe = NULL;
        sc->sc_opipe = NULL;
        sc->sc_oxfer = NULL;
@@ -626,8 +627,10 @@
 
        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;
+       }
 
        /* Disable interrupts. */
        if (sc->sc_opipe != NULL) {



Home | Main Index | Thread Index | Old Index