* [PATCH] x86: boot/compressed/mkpiggy.c: fix resource leakage
@ 2013-01-14 18:14 Cong Ding
2013-01-15 1:18 ` David Daney
0 siblings, 1 reply; 2+ messages in thread
From: Cong Ding @ 2013-01-14 18:14 UTC (permalink / raw)
To: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, x86, Matt Fleming,
linux-kernel
Cc: Cong Ding
the file should be closed if it goes to error.
Signed-off-by: Cong Ding <dinggnu@gmail.com>
---
arch/x86/boot/compressed/mkpiggy.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c
index 958a641..e29154f 100644
--- a/arch/x86/boot/compressed/mkpiggy.c
+++ b/arch/x86/boot/compressed/mkpiggy.c
@@ -58,6 +58,7 @@ int main(int argc, char *argv[])
if (fread(&olen, sizeof(olen), 1, f) != 1) {
perror(argv[1]);
+ fclose(f);
return 1;
}
--
1.7.9.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] x86: boot/compressed/mkpiggy.c: fix resource leakage
2013-01-14 18:14 [PATCH] x86: boot/compressed/mkpiggy.c: fix resource leakage Cong Ding
@ 2013-01-15 1:18 ` David Daney
0 siblings, 0 replies; 2+ messages in thread
From: David Daney @ 2013-01-15 1:18 UTC (permalink / raw)
To: Cong Ding
Cc: H. Peter Anvin, Thomas Gleixner, Ingo Molnar, x86, Matt Fleming,
linux-kernel
On 01/14/2013 10:14 AM, Cong Ding wrote:
> the file should be closed if it goes to error.
>
What tool are you using to generate all these patches?
> Signed-off-by: Cong Ding <dinggnu@gmail.com>
> ---
> arch/x86/boot/compressed/mkpiggy.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/arch/x86/boot/compressed/mkpiggy.c b/arch/x86/boot/compressed/mkpiggy.c
> index 958a641..e29154f 100644
> --- a/arch/x86/boot/compressed/mkpiggy.c
> +++ b/arch/x86/boot/compressed/mkpiggy.c
> @@ -58,6 +58,7 @@ int main(int argc, char *argv[])
>
> if (fread(&olen, sizeof(olen), 1, f) != 1) {
> perror(argv[1]);
> + fclose(f);
The next line is a return from main(). All FILEs will be automatically
closed by the C library, so your change is redundant.
The x86 maintainers can do what ever they want with it. But to me, it
seems like unnecessary code churn.
David Daney
> return 1;
> }
>
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-01-15 1:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-14 18:14 [PATCH] x86: boot/compressed/mkpiggy.c: fix resource leakage Cong Ding
2013-01-15 1:18 ` David Daney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox