diff --git a/sys/dev/raid/mps/mps.c b/sys/dev/raid/mps/mps.c --- a/sys/dev/raid/mps/mps.c +++ b/sys/dev/raid/mps/mps.c @@ -1040,8 +1040,11 @@ mps_attach(struct mps_softc *sc) sc->facts = kmalloc(sizeof(MPI2_IOC_FACTS_REPLY), M_MPT2, M_ZERO|M_WAITOK); - if ((error = mps_get_iocfacts(sc, sc->facts)) != 0) + if ((error = mps_get_iocfacts(sc, sc->facts)) != 0) { + kfree(sc->facts, M_MPT2); + sc->facts = NULL; return (error); + } mps_print_iocfacts(sc, sc->facts); @@ -1069,8 +1072,11 @@ mps_attach(struct mps_softc *sc) if ((sc->facts->IOCCapabilities & MPI2_IOCFACTS_CAPABILITY_EVENT_REPLAY) == 0) { mps_diag_reset(sc); - if ((error = mps_transition_ready(sc)) != 0) + if ((error = mps_transition_ready(sc)) != 0) { + kfree(sc->facts, M_MPT2); + sc->facts = NULL; return (error); + } } /*