summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2020-09-18 08:09:09 +0200
committerDaniel Stenberg <daniel@haxx.se>2020-09-18 08:10:51 +0200
commit41e8d223f6b078dae35fdb35368921d11a1a9155 (patch)
tree83f3cddbebbf990b039bf6edde9025cd8acdd63a /src
parent7921b41ce1b0d8bf8ebe42456116c6b2fece485d (diff)
downloadcurl-41e8d223f6b078dae35fdb35368921d11a1a9155.tar.gz
--help: strdup the category
... since it is converted and the original pointer is freed on Windows unicode handling. Follow-up to aa8777f63febc Fixes #5977 Reported-by: xwxbug on github
Diffstat (limited to 'src')
-rw-r--r--src/tool_getparam.c4
-rw-r--r--src/tool_help.c1
2 files changed, 4 insertions, 1 deletions
diff --git a/src/tool_getparam.c b/src/tool_getparam.c
index a884f4b38..517f94a3a 100644
--- a/src/tool_getparam.c
+++ b/src/tool_getparam.c
@@ -1777,7 +1777,9 @@ ParameterError getparameter(const char *flag, /* f or -long-flag */
case 'h': /* h for help */
if(toggle) {
- global->help_category = nextarg;
+ global->help_category = strdup(nextarg);
+ if(!global->help_category)
+ return PARAM_NO_MEM;
return PARAM_HELP_REQUESTED;
}
/* we now actually support --no-help too! */
diff --git a/src/tool_help.c b/src/tool_help.c
index 54a37e6b2..306e54b96 100644
--- a/src/tool_help.c
+++ b/src/tool_help.c
@@ -928,6 +928,7 @@ void tool_help(const char *category)
puts("Invalid category provided, here is a list of all categories:\n");
get_categories();
}
+ free((char *)category);
}
static int