All of lore.kernel.org
 help / color / mirror / Atom feed
From: Darren Kenny <darren.kenny@oracle.com>
To: grub-devel@gnu.org
Cc: daniel.kiper@oracle.com, darren.kenny@oracle.com
Subject: [PATCH 1/6] grub-install-common: Fix memory leak in copy_all()
Date: Tue, 26 Oct 2021 15:02:35 +0000	[thread overview]
Message-ID: <e0765386c7d9dcbed02404377bec324b5fd33dad.1635260363.git.darren.kenny@oracle.com> (raw)
In-Reply-To: <cover.1635260363.git.darren.kenny@oracle.com>

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	other threads:[~2021-10-26 15:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-26 15:02 [PATCH 0/6] Fix some Coverity low-hanging bugs Darren Kenny
2021-10-26 15:02 ` Darren Kenny [this message]
2021-10-26 15:02 ` [PATCH 2/6] grub-mkrescue: Fix memory leak in write_part() Darren Kenny
2021-10-26 15:02 ` [PATCH 3/6] grub-fstest: Fix resource leaks in cmd_cmp() Darren Kenny
2021-10-26 15:02 ` [PATCH 4/6] grub-mkfont: Fix memory leak in write_font_pf2() Darren Kenny
2021-10-26 15:02 ` [PATCH 5/6] zfs: Fix possible insecure use of chunk size in zap_leaf_array_get() Darren Kenny
2021-10-26 15:02 ` [PATCH 6/6] gzio: Fix possible use of uninitialized variable in huft_build() Darren Kenny
2021-10-28 21:29 ` [PATCH 0/6] Fix some Coverity low-hanging bugs Daniel Kiper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e0765386c7d9dcbed02404377bec324b5fd33dad.1635260363.git.darren.kenny@oracle.com \
    --to=darren.kenny@oracle.com \
    --cc=daniel.kiper@oracle.com \
    --cc=grub-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.