From 32404d58a17f1df89e062fde59f91d0704b9269f Mon Sep 17 00:00:00 2001 From: rpaulo Date: Tue, 4 Jul 2006 18:26:29 +0000 Subject: [PATCH] Coverity CID 3805: Close the firmware_handle on error and avoid leaks. --- sys/dev/ic/rt2661.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sys/dev/ic/rt2661.c b/sys/dev/ic/rt2661.c index af2d4dcfd50b..706d860b39e9 100644 --- a/sys/dev/ic/rt2661.c +++ b/sys/dev/ic/rt2661.c @@ -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 -__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; }