From 05aabdfcf1bad0453f1376290ea758d2e967660e Mon Sep 17 00:00:00 2001 From: Sam Leffler Date: Sat, 26 Mar 2005 18:17:58 +0000 Subject: [PATCH] eliminate double free when sym_cam_attach fails Noticed by: Coverity Prevent analysis tool --- sys/dev/sym/sym_hipd.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/sys/dev/sym/sym_hipd.c b/sys/dev/sym/sym_hipd.c index 7e05c2257e65..54abca694bdf 100644 --- a/sys/dev/sym/sym_hipd.c +++ b/sys/dev/sym/sym_hipd.c @@ -9203,15 +9203,20 @@ static int sym_cam_attach(hcb_p np) */ static void sym_cam_free(hcb_p np) { - if (np->intr) + if (np->intr) { bus_teardown_intr(np->device, np->irq_res, np->intr); + np->intr = NULL; + } if (np->sim) { xpt_bus_deregister(cam_sim_path(np->sim)); cam_sim_free(np->sim, /*free_devq*/ TRUE); + np->sim = NULL; } - if (np->path) + if (np->path) { xpt_free_path(np->path); + np->path = NULL; + } } /*============ OPTIONNAL NVRAM SUPPORT =================*/