Coverity CID 3805: Close the firmware_handle on error and avoid leaks.

This commit is contained in:
rpaulo 2006-07-04 18:26:29 +00:00
parent 0eda04c460
commit 32404d58a1
1 changed files with 5 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: rt2661.c,v 1.9 2006/06/18 15:44:49 rpaulo Exp $ */
/* $NetBSD: rt2661.c,v 1.10 2006/07/04 18:26:29 rpaulo Exp $ */
/* $OpenBSD: rt2661.c,v 1.17 2006/05/01 08:41:11 damien Exp $ */
/* $FreeBSD: rt2560.c,v 1.5 2006/06/02 19:59:31 csjp Exp $ */
@ -25,7 +25,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.9 2006/06/18 15:44:49 rpaulo Exp $");
__KERNEL_RCSID(0, "$NetBSD: rt2661.c,v 1.10 2006/07/04 18:26:29 rpaulo Exp $");
#include "bpfilter.h"
@ -2670,6 +2670,7 @@ rt2661_init(struct ifnet *ifp)
if (!(ucode = firmware_malloc(size))) {
printf("%s: could not alloc microcode memory\n",
sc->sc_dev.dv_xname);
firmware_close(fh);
rt2661_stop(ifp, 1);
return ENOMEM;
}
@ -2678,6 +2679,7 @@ rt2661_init(struct ifnet *ifp)
printf("%s: could not read microcode %s\n",
sc->sc_dev.dv_xname, name);
firmware_free(ucode, 0);
firmware_close(fh)
rt2661_stop(ifp, 1);
return EIO;
}
@ -2686,6 +2688,7 @@ rt2661_init(struct ifnet *ifp)
printf("%s: could not load 8051 microcode\n",
sc->sc_dev.dv_xname);
firmware_free(ucode, 0);
firmware_close(fh);
rt2661_stop(ifp, 1);
return EIO;
}