mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
cov: avoid leak when repeating options
Do not leak previous buffer, when option is set more then once.
This commit is contained in:
parent
7e77e250a9
commit
3d96203e21
@ -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':
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user