[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 1/6] grub-install-common: Fix memory leak in copy_all()
From: |
Darren Kenny |
Subject: |
[PATCH 1/6] grub-install-common: Fix memory leak in copy_all() |
Date: |
Tue, 26 Oct 2021 15:02:35 +0000 |
The copy_all() function skips a section of code using continue, but
fails to free the memory in srcf first, leaking it.
Fixes: CID 314026
Signed-off-by: Darren Kenny <darren.kenny@oracle.com>
---
util/grub-install-common.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/util/grub-install-common.c b/util/grub-install-common.c
index 4e212e690c52..0995fa741834 100644
--- a/util/grub-install-common.c
+++ b/util/grub-install-common.c
@@ -753,8 +753,10 @@ copy_all (const char *srcd,
continue;
srcf = grub_util_path_concat (2, srcd, de->d_name);
if (grub_util_is_special_file (srcf)
- || grub_util_is_directory (srcf))
+ || grub_util_is_directory (srcf)) {
+ free(srcf);
continue;
+ }
dstf = grub_util_path_concat (2, dstd, de->d_name);
grub_install_compress_file (srcf, dstf, 1);
free (srcf);
--
2.27.0
- [PATCH 0/6] Fix some Coverity low-hanging bugs, Darren Kenny, 2021/10/26
- [PATCH 6/6] gzio: Fix possible use of uninitialized variable in huft_build(), Darren Kenny, 2021/10/26
- [PATCH 3/6] grub-fstest: Fix resource leaks in cmd_cmp(), Darren Kenny, 2021/10/26
- [PATCH 4/6] grub-mkfont: Fix memory leak in write_font_pf2(), Darren Kenny, 2021/10/26
- [PATCH 2/6] grub-mkrescue: Fix memory leak in write_part(), Darren Kenny, 2021/10/26
- [PATCH 1/6] grub-install-common: Fix memory leak in copy_all(),
Darren Kenny <=
- [PATCH 5/6] zfs: Fix possible insecure use of chunk size in zap_leaf_array_get(), Darren Kenny, 2021/10/26
- Re: [PATCH 0/6] Fix some Coverity low-hanging bugs, Daniel Kiper, 2021/10/28