--- a/scripts/config2help.c 2017-08-24 17:14:30.000000000 -0700 +++ b/scripts/config2help.c 2017-02-21 09:27:25.000000000 -0800 @@ -248,7 +248,7 @@ // entry until we run out of matching pairs. for (;;) { struct symbol *throw = 0, *catch; - char *this, *that, *cusage, *tusage, *name; + char *this, *that, *cusage, *tusage, *name = NULL, *that_start; int len; // find a usage: name and collate all enabled entries with that name @@ -261,11 +261,16 @@ // Align usage: lines, finding a matching pair so we can suck help // text out of throw into catch, copying from this to that - if (!throw) name = that; + if (!throw) { + if (name) + free(name); + name = strdup(that); + that_start = that; + } else if (strncmp(name, that, len) || !isspace(that[len])) continue; catch->enabled++; while (!isspace(*that) && *that) that++; - if (!throw) len = that-name; + if (!throw) len = that-that_start; that = trim(that); if (!throw) { throw = catch; @@ -370,6 +375,8 @@ } } + if (name) + free(name); // Did we find one? if (!throw) break;