From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - cmdlib_lvm2_init: release cmd on failure path
Date: Mon, 13 Sep 2021 10:36:23 +0000 (GMT) [thread overview]
Message-ID: <20210913103623.E4A7F3858006@sourceware.org> (raw)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b36ab8a0639e85a5674a83808ccbb526a7191699
Commit: b36ab8a0639e85a5674a83808ccbb526a7191699
Parent: cd897e536fb69281d5d8e3e382a3827640913bd1
Author: Wu Guanghao <wuguanghao3@huawei.com>
AuthorDate: Mon Aug 30 15:13:00 2021 +0800
Committer: Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Mon Sep 13 12:34:41 2021 +0200
cmdlib_lvm2_init: release cmd on failure path
The cmd memory space is allocated by zalloc, and the registration
fails and is not released.
Although this code would be ever triggered just in the case
of some internal (likely compilation) bug.
Signed-off-by: Wu Guanghao <wuguanghao3@huawei.com>
---
tools/lvmcmdlib.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tools/lvmcmdlib.c b/tools/lvmcmdlib.c
index 152d176b2..6b326893c 100644
--- a/tools/lvmcmdlib.c
+++ b/tools/lvmcmdlib.c
@@ -33,8 +33,10 @@ void *cmdlib_lvm2_init(unsigned static_compile, unsigned threaded)
if (!(cmd = init_lvm(1, 1, threaded)))
return NULL;
- if (!lvm_register_commands(cmd, NULL))
+ if (!lvm_register_commands(cmd, NULL)) {
+ free(cmd);
return NULL;
+ }
return (void *) cmd;
}
reply other threads:[~2021-09-13 10: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=20210913103623.E4A7F3858006@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.