x86: boot/compressed/mkpiggy.c: fix resource leakage
PATCH 1/1 x86: boot/compressed/mkpiggy.c: fix resource leakage
the file should be closed if it goes to error.
Signed-off-by Cong Ding <[email protected]>
--- arch/x86/boot/compressed/mkpiggy.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/boot/compressed/mkpiggy.c +1 -0
@@ -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 ; }
Signature · 1 line
1.7.9.5
Quoted 2 lines · Cong Ding
the file should be closed if it goes to error.
What tool are you using to generate all these patches?
Quoted 10 lines
Signed-off-by Cong Ding <[email protected]>--- arch/x86/boot/compressed/mkpiggy.c | 1 + 1 file changed, 1 insertion(+)arch/x86/boot/compressed/mkpiggy.c +0
-0
arch/x86/boot/compressed/mkpiggy.c int main(int argc, char *argv[]) · line 61
Quoted 4 lines
arch/x86/boot/compressed/mkpiggy.c +1
-0@@ -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
Quoted 4 lines
arch/x86/boot/compressed/mkpiggy.c +0
-0return 1 ; }