diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2021-09-14 23:06:17 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2021-09-15 15:24:56 +0200 |
commit | 73087c2c0fd51b1ff543580dadbf3d02dd49a35d (patch) | |
tree | 7e4c468d97b077ff776bdf725ca88af5802119c9 /daemons/lvmlockd | |
parent | dd5f8b3f8c18ff57525ec5c5b35c6e1d218b1000 (diff) | |
download | lvm2-73087c2c0fd51b1ff543580dadbf3d02dd49a35d.tar.gz |
clang: free on arg parsing
If the parameter would be given twice, the 1st. alloc memleaks.
Diffstat (limited to 'daemons/lvmlockd')
-rw-r--r-- | daemons/lvmlockd/lvmlockd-core.c | 4 |
1 files changed, 4 insertions, 0 deletions
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': |