diff options
Diffstat (limited to 'lib/popt')
-rw-r--r-- | lib/popt/popthelp.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/lib/popt/popthelp.c b/lib/popt/popthelp.c index e965ff6168e..0ed355a18d7 100644 --- a/lib/popt/popthelp.c +++ b/lib/popt/popthelp.c @@ -240,22 +240,23 @@ static void singleOptionHelp(FILE * fp, int maxLeftCol, /* Choose type of output */ /*@-branchstate@*/ if (opt->argInfo & POPT_ARGFLAG_SHOW_DEFAULT) { - defs = singleOptionDefaultValue(lineLength, opt, translation_domain); - if (defs) { - char * t = (char *)malloc((help ? strlen(help) : 0) + + defs = singleOptionDefaultValue(lineLength, opt, translation_domain); + if (defs) { + char * t = (char *)malloc((help ? strlen(help) : 0) + strlen(defs) + sizeof(" ")); - if (t) { - char * te = t; - *te = '\0'; - if (help) { - strcpy(te, help); te += strlen(te); - } - *te++ = ' '; - strcpy(te, defs); - defs = (char *)_free(defs); + if (t) { + char * te = t; + *te = '\0'; + if (help) { + strcpy(te, help); + te += strlen(te); + } + *te++ = ' '; + strcpy(te, defs); + defs = (char *)_free(defs); + } + defs = t; } - defs = t; - } } /*@=branchstate@*/ |