Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/usb CID/1261465: Dereference after NULL check.



details:   https://anonhg.NetBSD.org/src/rev/1323923abdf8
branches:  trunk
changeset: 805442:1323923abdf8
user:      christos <christos%NetBSD.org@localhost>
date:      Fri Jan 02 16:38:45 2015 +0000

description:
CID/1261465: Dereference after NULL check.
CID/1261467: Unreachable code

diffstat:

 sys/dev/usb/umidi.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (39 lines):

diff -r 873a93a7fafc -r 1323923abdf8 sys/dev/usb/umidi.c
--- a/sys/dev/usb/umidi.c       Fri Jan 02 15:53:25 2015 +0000
+++ b/sys/dev/usb/umidi.c       Fri Jan 02 16:38:45 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: umidi.c,v 1.66 2014/12/21 23:00:35 mrg Exp $   */
+/*     $NetBSD: umidi.c,v 1.67 2015/01/02 16:38:45 christos Exp $      */
 
 /*
  * Copyright (c) 2001, 2012, 2014 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: umidi.c,v 1.66 2014/12/21 23:00:35 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: umidi.c,v 1.67 2015/01/02 16:38:45 christos Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -386,9 +386,9 @@
        }
        err = attach_all_mididevs(sc);
        if (err != USBD_NORMAL_COMPLETION) {
-               goto out_free_jacks;
                aprint_error_dev(self,
                    "attach_all_mididevs failed. (err=%d)\n", err);
+               goto out_free_jacks;
        }
 
 #ifdef UMIDI_DEBUG
@@ -512,7 +512,8 @@
                KASSERT(mididev->opened);
                if (err != USBD_NORMAL_COMPLETION &&
                    err != USBD_IN_PROGRESS) {
-                       close_out_jack(mididev->out_jack);
+                       if (mididev->out_jack)
+                               close_out_jack(mididev->out_jack);
                        goto bad;
                }
        }



Home | Main Index | Thread Index | Old Index