util/grub-mkrescue: Fix memory leak in write_part()

In the function write_part(), the value of inname is not used beyond
the grub_util_fopen() call, so it should be freed to avoid leakage.

Fixes: CID 314028

Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Darren Kenny 2021-10-26 15:02:36 +00:00 committed by Daniel Kiper
parent e07fcea291
commit eff17a6b2d

View File

@ -229,6 +229,7 @@ write_part (FILE *f, const char *srcdir)
char *inname = grub_util_path_concat (2, srcdir, "partmap.lst");
char buf[260];
in = grub_util_fopen (inname, "rb");
free (inname);
if (!in)
return;
while (fgets (buf, 256, in))