kexec-tools: fix leak FILE pointer.
Subsystems (2)
PATCH 1/1 kexec-tools: fix leak FILE pointer.
Close fp if file size is smaller than 13 bytes.
Signed-off-by Lichen Liu <[email protected]>
--- kexec/lzma.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kexec/lzma.c +4 -1
@@ -170,8 +170,11 @@ int is_lzma_file(const char *filename)const size_t size =fread (buf,1 ,sizeof (buf), fp); -if (size !=13 ) +if (size !=13 ) { +/* file is too small to be a lzma file. */ +fclose (fp);return 0 ; + }lzma_filter filter = { .id =LZMA_FILTER_LZMA1 };
Signature · 1 line
2.27.0
Simon Horman
AppliedPATCH 1/1 kexec-tools: fix leak FILE pointer.
Quoted 3 lines · Lichen Liu
Close fp if file size is smaller than 13 bytes.
Signed-off-by Lichen Liu <[email protected]>
Thanks, applied.