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" <crb@ChrisBowman.com>
This commit is contained in:
ken 1999-05-21 22:02:02 +00:00
parent e774b28d83
commit 7f5e1ec2d8

View File

@ -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;
}