From cd0ae8bc3fd6cd643ef67f068a00d7f91927b0ea Mon Sep 17 00:00:00 2001 From: Andre Noll Date: Sun, 13 Jan 2019 21:01:14 +0100 Subject: [PATCH 1/1] lls_parse_arg(): Don't free static memory. If opt->values is not NULL, no string value is stored on the heap, and the current code results is a segmentation fault. --- lopsub.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lopsub.c b/lopsub.c index 55ea6ac..44abc93 100644 --- a/lopsub.c +++ b/lopsub.c @@ -651,7 +651,7 @@ static int lls_parse_arg(struct lls_arg *la, const struct lls_option *opts, } switch (opt->arg_type) { case LLS_STRING: - if (lor->given > 0 && !multiple) + if (!opt->values && lor->given > 0 && !multiple) free(lor->value[idx].string_val); if (opt->values) { ret = check_enum_arg(la->arg, opt, errctx); -- 2.39.2