Free options before setting them. This will prevent us from leaking
memory when we have multiple copies of the same option from being specified. Sponsored by: Netflix
This commit is contained in:
parent
da15338df8
commit
63b5669494
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=327573
@ -217,6 +217,7 @@ parse_args(int argc, char *argv[])
|
||||
opts.dry_run = true;
|
||||
break;
|
||||
case 'e':
|
||||
free(opts.env);
|
||||
opts.env = strdup(optarg);
|
||||
break;
|
||||
case 'h':
|
||||
@ -224,12 +225,15 @@ parse_args(int argc, char *argv[])
|
||||
errx(1, "%s", USAGE);
|
||||
break;
|
||||
case 'k':
|
||||
free(opts.kernel);
|
||||
opts.kernel = strdup(optarg);
|
||||
break;
|
||||
case 'L':
|
||||
free(opts.label);
|
||||
opts.label = strdup(optarg);
|
||||
break;
|
||||
case 'l':
|
||||
free(opts.loader);
|
||||
opts.loader = strdup(optarg);
|
||||
opts.loader = mangle_loader(opts.loader);
|
||||
break;
|
||||
@ -244,6 +248,7 @@ parse_args(int argc, char *argv[])
|
||||
opts.once = true;
|
||||
break;
|
||||
case 'o':
|
||||
free(opts.order);
|
||||
opts.order = strdup(optarg);
|
||||
break;
|
||||
case 'T':
|
||||
|
Loading…
Reference in New Issue
Block a user