diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2021-11-18 12:22:59 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2021-11-18 12:22:59 +0200 |
commit | f3c7872fed5e0782438d186ac88c63035a637462 (patch) | |
tree | fec0e4683eec3e66f547187f5b666132b0f5aa8f | |
parent | bc2a36294a31e7e65004b129e2c8a5057e5f9bac (diff) | |
download | gdbm-f3c7872fed5e0782438d186ac88c63035a637462.tar.gz |
Fix gdbmtool import command
* src/gdbmshell.c (import_handler): Fix option addressing (see
https://puszcza.gnu.org.ua/bugs/?535).
Fix freeing of the uninitialized variable.
-rw-r--r-- | src/gdbmshell.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/gdbmshell.c b/src/gdbmshell.c index 08042ce..96b5844 100644 --- a/src/gdbmshell.c +++ b/src/gdbmshell.c @@ -661,7 +661,7 @@ err_printer (void *data GDBM_ARG_UNUSED, char const *fmt, ...) fprintf (stderr, "\n"); } -/* recover sumamry verbose backup max-failed-keys=N max-failed-buckets=N max-failures=N */ +/* recover summary verbose backup max-failed-keys=N max-failed-buckets=N max-failures=N */ static int recover_handler (struct command_param *param, struct command_environ *cenv) { @@ -1585,7 +1585,7 @@ import_handler (struct command_param *param, int rc = GDBMSHELL_OK; char *file_name; - for (i = 0; i < param->argc; i++) + for (i = 1; i < param->argc; i++) { if (strcmp (PARAM_STRING (param, i), "replace") == 0) flag = GDBM_REPLACE; @@ -1637,7 +1637,6 @@ import_handler (struct command_param *param, return GDBMSHELL_GDBM_ERR; } - free (file_name); if (gdbm_setopt (gdbm_file, GDBM_GETDBNAME, &file_name, sizeof (file_name))) { dberror ("%s", "GDBM_GETDBNAME"); |