All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - cov: memleak on error path
Date: Wed, 10 Mar 2021 00:36:39 +0000 (GMT)	[thread overview]
Message-ID: <20210310003639.EEFFF3858038@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a6075fe2f259c4b2abd946cf06f9b507f9a7a49e
Commit:        a6075fe2f259c4b2abd946cf06f9b507f9a7a49e
Parent:        241c63f7a72cecad085c8983b8a294d8d9985119
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Tue Mar 9 15:38:54 2021 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Wed Mar 10 01:29:44 2021 +0100

cov: memleak on error path

---
 lib/device/dev-cache.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 6cf798858..05b2b9bff 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1713,8 +1713,10 @@ static int _setup_devices_list(struct cmd_context *cmd)
 		if (!(du = zalloc(sizeof(struct dev_use))))
 			return_0;
 
-		if (!(du->devname = strdup(strl->str)))
+		if (!(du->devname = strdup(strl->str))) {
+			free(du);
 			return_0;
+		}
 
 		dm_list_add(&cmd->use_devices, &du->list);
 	}



                 reply	other threads:[~2021-03-10  0:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20210310003639.EEFFF3858038@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /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.