summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordlg <dlg@openbsd.org>2005-11-13 02:21:42 +0000
committerdlg <dlg@openbsd.org>2005-11-13 02:21:42 +0000
commitb6c5cf15dc3ded300a947a47f46afa07cd1759ed (patch)
tree208645dcd942cc323972bcf606715a6e88af13b8
parenthandle asprintf() failure; from dhill@mindcry.org (diff)
downloadwireguard-openbsd-b6c5cf15dc3ded300a947a47f46afa07cd1759ed.tar.xz
wireguard-openbsd-b6c5cf15dc3ded300a947a47f46afa07cd1759ed.zip
if the particular ses device has no slots or sensors to handle, then free
all the resources.
-rw-r--r--sys/scsi/ses.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sys/scsi/ses.c b/sys/scsi/ses.c
index bcd33f0de48..97d71c77709 100644
--- a/sys/scsi/ses.c
+++ b/sys/scsi/ses.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ses.c,v 1.29 2005/11/12 08:09:47 dlg Exp $ */
+/* $OpenBSD: ses.c,v 1.30 2005/11/13 02:21:42 dlg Exp $ */
/*
* Copyright (c) 2005 David Gwynne <dlg@openbsd.org>
@@ -189,6 +189,14 @@ ses_attach(struct device *parent, struct device *self, void *aux)
}
#endif
+ if (TAILQ_EMPTY(&sc->sc_sensors)
+#if NBIO > 0
+ && TAILQ_EMPTY(&sc->sc_slots)
+#endif
+ ) {
+ free(sc->sc_buf, M_DEVBUF);
+ sc->sc_buf = NULL;
+ }
}
int