From ed75ef34d43fbcb1b0bea2f96cbc7d76b096fa75 Mon Sep 17 00:00:00 2001 From: "Bjoern A. Zeeb" Date: Fri, 4 Sep 2020 18:26:35 +0000 Subject: [PATCH] umass: fix a cam_sim leak in error case While debugging a hang I noticed that in case of error in umass_cam_attach_sim() we miss a cam_sim_free() call. Added that to not leak resources. Reviewed by: hselasky MFC after: 3 days Differential Revision: D26287 --- sys/dev/usb/storage/umass.c | 1 + 1 file changed, 1 insertion(+) diff --git a/sys/dev/usb/storage/umass.c b/sys/dev/usb/storage/umass.c index 7e305ad4fdc..546d524cdf3 100644 --- a/sys/dev/usb/storage/umass.c +++ b/sys/dev/usb/storage/umass.c @@ -2094,6 +2094,7 @@ umass_cam_attach_sim(struct umass_softc *sc) if (xpt_bus_register(sc->sc_sim, sc->sc_dev, sc->sc_unit) != CAM_SUCCESS) { + cam_sim_free(sc->sc_sim, /* free_devq */ TRUE); mtx_unlock(&sc->sc_mtx); return (ENOMEM); }