From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - clang: free on arg parsing
Date: Wed, 15 Sep 2021 13:26:28 +0000 (GMT) [thread overview]
Message-ID: <20210915132628.BA9FB3858413@sourceware.org> (raw)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=73087c2c0fd51b1ff543580dadbf3d02dd49a35d
Commit: 73087c2c0fd51b1ff543580dadbf3d02dd49a35d
Parent: dd5f8b3f8c18ff57525ec5c5b35c6e1d218b1000
Author: Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate: Tue Sep 14 23:06:17 2021 +0200
Committer: Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Wed Sep 15 15:24:56 2021 +0200
clang: free on arg parsing
If the parameter would be given twice, the 1st. alloc memleaks.
---
daemons/lvmlockd/lvmlockd-core.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index a3964c857..e53eebfe7 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -6280,6 +6280,7 @@ int main(int argc, char *argv[])
.daemon_fini = NULL,
.daemon_main = main_loop,
};
+ daemon_host_id_file = NULL;
static struct option long_options[] = {
{"help", no_argument, 0, 'h' },
@@ -6332,9 +6333,11 @@ int main(int argc, char *argv[])
daemon_debug = 1;
break;
case 'p':
+ free((void*)ds.pidfile);
ds.pidfile = strdup(optarg);
break;
case 's':
+ free((void*)ds.socket_path);
ds.socket_path = strdup(optarg);
break;
case 'g':
@@ -6354,6 +6357,7 @@ int main(int argc, char *argv[])
daemon_host_id = atoi(optarg);
break;
case 'F':
+ free((void*)daemon_host_id_file);
daemon_host_id_file = strdup(optarg);
break;
case 'o':
reply other threads:[~2021-09-15 13:26 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=20210915132628.BA9FB3858413@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.