diff options
Diffstat (limited to '')
-rw-r--r-- | cmdline.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -34,22 +34,21 @@ NUSAGE(libsimple_default_failure_exit, void -cmdline(int *argcp, char ***argvp, struct config *config) +cmdline(int *argcp, char ***argvp, struct config *config, char **algostrbufp) { int old_argc = *argcp; int argc = *argcp; char **argv = *argvp; const char *algostr = NULL; - char *algostrbuf = NULL; argv0 = argv[0]; command = getcommand(&algostr, &algorithm); switch (getsupercommand(command, algorithm)) { case BSUM: - argc = cmdline_bsum(argc, argv, command, config, &algostr, &algorithm, &algostrbuf); + argc = cmdline_bsum(argc, argv, command, config, &algostr, &algorithm, algostrbufp); break; case SHA3SUM: - argc = cmdline_sha3sum(argc, argv, command, config, &algostr, &algorithm, &algostrbuf); + argc = cmdline_sha3sum(argc, argv, command, config, &algostr, &algorithm, algostrbufp); break; case ANYSUM: case SPECIALISED: @@ -73,12 +72,12 @@ cmdline(int *argcp, char ***argvp, struct config *config) if (algostr) { config->algorithms = erealloc(config->algorithms, sizeof(*config->algorithms)); + memset(&(config->algorithms)[0], 0, sizeof(config->algorithms[0])); (config->algorithms)[0].algostr = algostr; + (config->algorithms)[0].result = NULL; config->nalgorithms = 1U; } *argcp = argc; *argvp = &argv[old_argc - argc]; - - free(algostrbuf); } |