Module Name:    src
Committed By:   christos
Date:           Fri Jan  2 16:38:45 UTC 2015

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

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


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/usb/umidi.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/umidi.c
diff -u src/sys/dev/usb/umidi.c:1.66 src/sys/dev/usb/umidi.c:1.67
--- src/sys/dev/usb/umidi.c:1.66	Sun Dec 21 18:00:35 2014
+++ src/sys/dev/usb/umidi.c	Fri Jan  2 11:38:45 2015
@@ -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 @@ umidi_attach(device_t parent, device_t s
 	}
 	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 @@ umidi_open(void *addr,
 		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;
 		}
 	}

Reply via email to