From: Karel Zak Date: Wed, 29 Jul 2015 12:59:56 +0000 (+0200) Subject: mcookie: fix -f usage [clang analyze] X-Git-Tag: v2.27-rc1~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dd8dac1914e7e51c0855c57c8f515608c0c8179f;p=thirdparty%2Futil-linux.git mcookie: fix -f usage [clang analyze] Signed-off-by: Karel Zak --- diff --git a/misc-utils/mcookie.c b/misc-utils/mcookie.c index ee8ec38ba7..f26d4d2578 100644 --- a/misc-utils/mcookie.c +++ b/misc-utils/mcookie.c @@ -151,15 +151,14 @@ int main(int argc, char **argv) textdomain(PACKAGE); atexit(close_stdout); - if (2 < argc) - ctl.files = xmalloc(sizeof(char *) * argc); - while ((c = getopt_long(argc, argv, "f:m:vVh", longopts, NULL)) != -1) { switch (c) { case 'v': ctl.verbose = 1; break; case 'f': + if (!ctl.files) + ctl.files = xmalloc(sizeof(char *) * argc); ctl.files[ctl.nfiles++] = optarg; break; case 'm':