lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 31 May 2011 11:50:57 +0200
From:	Andre Bartke <andre.bartke@...glemail.com>
To:	tglx@...utronix.de
Cc:	x86@...nel.org, linux-kernel@...r.kernel.org,
	Andre Bartke <andre.bartke@...il.com>
Subject: [PATCH] x86: boot/compressed fix resource leak

In case fread() fails, we should call fclose
and release the resource properly. Also while at it,
fixed brace coding style issue.

Signed-off-by: Andre Bartke <andre.bartke@...il.com>
---
 arch/x86/boot/compressed/mkpiggy.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c
index 46a8238..33b85be 100644
--- a/arch/x86/boot/compressed/mkpiggy.c
+++ b/arch/x86/boot/compressed/mkpiggy.c
@@ -58,13 +58,12 @@ int main(int argc, char *argv[])
 		return 1;
 	}
 
-
-	if (fseek(f, -4L, SEEK_END)) {
+	if (fseek(f, -4L, SEEK_END))
 		perror(argv[1]);
-	}
 
 	if (fread(&olen, sizeof(olen), 1, f) != 1) {
 		perror(argv[1]);
+		fclose(f);
 		return 1;
 	}
 
-- 
1.7.5.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ