Module Name:    src
Committed By:   christos
Date:           Thu Dec 26 15:32:48 UTC 2013

Modified Files:
        src/sys/dev/usb: uhidev.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/usb/uhidev.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/dev/usb/uhidev.c
diff -u src/sys/dev/usb/uhidev.c:1.58 src/sys/dev/usb/uhidev.c:1.59
--- src/sys/dev/usb/uhidev.c:1.58	Sat Oct  5 03:05:01 2013
+++ src/sys/dev/usb/uhidev.c	Thu Dec 26 10:32:48 2013
@@ -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 @@ out1:
 	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 @@ uhidev_close(struct uhidev *scd)
 
 	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) {

Reply via email to