cmd: Don't leak memory when constructing help string
authorSimon Wilkinson <sxw@your-file-system.com>
Sat, 31 Mar 2012 19:27:53 +0000 (15:27 -0400)
committerDerrick Brashear <shadow@dementix.org>
Mon, 9 Apr 2012 01:23:49 +0000 (18:23 -0700)
It's not critical, because we'll be exiting soon afterwards, but just
to be nice, don't leak the name of every command option whilst we're
constructing the help string.

Caught by clang-analyzer

Change-Id: I87fdb2030c6a7c5ad810f2a06820c08cbe2fb18e
Reviewed-on: http://gerrit.openafs.org/7107
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementix.org>

src/cmd/cmd.c

index f5282a3..4389adc 100644 (file)
@@ -254,6 +254,7 @@ PrintSyntax(struct cmd_syndesc *as)
               str,
               tp->flags & CMD_OPTIONAL?"]":"");
        free(str);
+       free(name);
        len+=xtralen;
     }
     printf("\n");