summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorNathan Binkert <nate@cvs.openbsd.org>2003-05-19 00:36:34 +0000
committerNathan Binkert <nate@cvs.openbsd.org>2003-05-19 00:36:34 +0000
commit9ccc4d0d760d1b6fdc595afe3a20cec80c0c469b (patch)
treebe9f4bc13104e2850665d1a5f50e6e0b5e8c9465 /sys
parent39b20503c771788563ad192a00c178bbcac6863a (diff)
check for null before memset
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/usb/umidi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/dev/usb/umidi.c b/sys/dev/usb/umidi.c
index c080be52ed6..266b719820d 100644
--- a/sys/dev/usb/umidi.c
+++ b/sys/dev/usb/umidi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: umidi.c,v 1.8 2003/05/07 04:33:33 deraadt Exp $ */
+/* $OpenBSD: umidi.c,v 1.9 2003/05/19 00:36:33 nate Exp $ */
/* $NetBSD: umidi.c,v 1.16 2002/07/11 21:14:32 augustss Exp $ */
/*
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -986,9 +986,9 @@ alloc_all_mididevs(struct umidi_softc *sc, int nmidi)
sc->sc_num_mididevs = nmidi;
sc->sc_mididevs = malloc(sizeof(*sc->sc_mididevs)*nmidi,
M_USBDEV, M_WAITOK);
- memset(sc->sc_mididevs, 0, sizeof(*sc->sc_mididevs)*nmidi);
if (!sc->sc_mididevs)
return USBD_NOMEM;
+ memset(sc->sc_mididevs, 0, sizeof(*sc->sc_mididevs)*nmidi);
return USBD_NORMAL_COMPLETION;
}