diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2021-04-22 17:53:45 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2021-04-23 22:59:25 +0200 |
commit | 3d96203e21be7fcea783afaa94e10295696a4533 (patch) | |
tree | 1b53d5adcff4f4e583896a796e350732420f6166 | |
parent | 7e77e250a9249f6b7c9bc63b88de393c02ef6a61 (diff) | |
download | lvm2-3d96203e21be7fcea783afaa94e10295696a4533.tar.gz |
cov: avoid leak when repeating options
Do not leak previous buffer, when option is set more then once.
-rw-r--r-- | daemons/lvmlockd/lvmlockctl.c | 4 | ||||
-rw-r--r-- | tools/pvck.c | 1 |
2 files changed, 5 insertions, 0 deletions
diff --git a/daemons/lvmlockd/lvmlockctl.c b/daemons/lvmlockd/lvmlockctl.c index 350e78e9a..32da99c6d 100644 --- a/daemons/lvmlockd/lvmlockctl.c +++ b/daemons/lvmlockd/lvmlockctl.c @@ -987,18 +987,22 @@ static int read_options(int argc, char *argv[]) break; case 'k': kill_vg = 1; + free(arg_vg_name); arg_vg_name = strdup(optarg); break; case 'r': drop_vg = 1; + free(arg_vg_name); arg_vg_name = strdup(optarg); break; case 'E': gl_enable = 1; + free(arg_vg_name); arg_vg_name = strdup(optarg); break; case 'D': gl_disable = 1; + free(arg_vg_name); arg_vg_name = strdup(optarg); break; case 'S': diff --git a/tools/pvck.c b/tools/pvck.c index 2af34dc57..6bc1c091f 100644 --- a/tools/pvck.c +++ b/tools/pvck.c @@ -1774,6 +1774,7 @@ static int _get_one_setting(struct cmd_context *cmd, struct settings *set, char } if (!strncmp(key, "backup_file", strlen("backup_file"))) { + free(set->backup_file); if ((set->backup_file = strdup(val))) return 1; return 0; |