From 7f5e1ec2d830ff814ff2c5c4966a8ba17d0624e5 Mon Sep 17 00:00:00 2001 From: ken Date: Fri, 21 May 1999 22:02:02 +0000 Subject: [PATCH] Fix a memory leak and a double free that could happen in certain error cases. These were unlikely to happen in normal operation. Noticed by: "Christopher R. Bowman" --- sys/pci/ncr.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/sys/pci/ncr.c b/sys/pci/ncr.c index 38c6731f502b..9953bad4b6e5 100644 --- a/sys/pci/ncr.c +++ b/sys/pci/ncr.c @@ -1,6 +1,6 @@ /************************************************************************** ** -** $Id: ncr.c,v 1.145 1999/05/09 17:07:09 peter Exp $ +** $Id: ncr.c,v 1.146 1999/05/09 22:44:42 se Exp $ ** ** Device driver for the NCR 53C8XX PCI-SCSI-Controller Family. ** @@ -1361,7 +1361,7 @@ static void ncr_attach (pcici_t tag, int unit); #if !defined(lint) static const char ident[] = - "\n$Id: ncr.c,v 1.145 1999/05/09 17:07:09 peter Exp $\n"; + "\n$Id: ncr.c,v 1.146 1999/05/09 22:44:42 se Exp $\n"; #endif static const u_long ncr_version = NCR_VERSION * 11 @@ -3848,7 +3848,7 @@ ncr_attach (pcici_t config_id, int unit) if (xpt_bus_register(np->sim, 0) != CAM_SUCCESS) { - free(np->sim, M_DEVBUF); + cam_sim_free(np->sim, /*free_devq*/ TRUE); return; } @@ -3860,8 +3860,7 @@ ncr_attach (pcici_t config_id, int unit) cam_sim_path(np->sim), CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD) != CAM_REQ_CMP) { xpt_bus_deregister(cam_sim_path(np->sim)); - cam_sim_free(np->sim, /*free_simq*/TRUE); - free(np->sim, M_DEVBUF); + cam_sim_free(np->sim, /*free_devq*/TRUE); return; }