grub-devel
[Top][All Lists]
Advanced

[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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]