From: Ralph Corderoy Date: Wed, 22 Mar 2017 14:47:18 +0000 (+0000) Subject: Fix free(3) of unmalloc()'d string in whatnow's refile. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/5563763309077db8db57b6e0c3c636a6a5a0a1b5?ds=inline Fix free(3) of unmalloc()'d string in whatnow's refile. `ref +foo' at comp(1)'s whatnow prompt was trying to free "+foo". Take a copy of the string so the later free works. Tom Rodman reported the problem to nmh-workers. Bug introduced in 3b6be5607a251a3a793e97382e251ce66ea2bca0. --- diff --git a/sbr/refile.c b/sbr/refile.c index 43ad908e..b3402cfe 100644 --- a/sbr/refile.c +++ b/sbr/refile.c @@ -29,7 +29,7 @@ refile (char **arg, char *file) if (arg) { while (*arg) - vec[vecp++] = *arg++; + vec[vecp++] = mh_xstrdup(*arg++); } vec[vecp] = NULL;