summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/geom/eli/g_eli.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/geom/eli/g_eli.c b/sys/geom/eli/g_eli.c
index fd04ee2..08219dc 100644
--- a/sys/geom/eli/g_eli.c
+++ b/sys/geom/eli/g_eli.c
@@ -952,9 +952,12 @@ g_eli_destroy(struct g_eli_softc *sc, boolean_t force)
}
mtx_destroy(&sc->sc_queue_mtx);
gp->softc = NULL;
- bzero(sc->sc_ekeys,
- sc->sc_nekeys * (sizeof(uint8_t *) + G_ELI_DATAKEYLEN));
- free(sc->sc_ekeys, M_ELI);
+ if (sc->sc_ekeys != NULL) {
+ /* The sc_ekeys field can be NULL is device is suspended. */
+ bzero(sc->sc_ekeys,
+ sc->sc_nekeys * (sizeof(uint8_t *) + G_ELI_DATAKEYLEN));
+ free(sc->sc_ekeys, M_ELI);
+ }
bzero(sc, sizeof(*sc));
free(sc, M_ELI);
OpenPOWER on IntegriCloud