All of lore.kernel.org
 help / color / mirror / Atom feed
* main - cov: memleak on error path
@ 2021-03-10  0:36 Zdenek Kabelac
  0 siblings, 0 replies; only message in thread
From: Zdenek Kabelac @ 2021-03-10  0:36 UTC (permalink / raw)
  To: lvm-devel

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);
 	}



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-10  0:36 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-10  0:36 main - cov: memleak on error path Zdenek Kabelac

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.