summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org>2022-06-18 17:35:35 +0300
committerSergey Poznyakoff <gray@gnu.org>2022-06-18 17:35:35 +0300
commitc3dc7294670c91af89e0122c6979de70c63ce4f7 (patch)
tree130f114ad35d696299753d167eaba3cc0e25d516
parent7302b2397357066bcde7c0e23bb36bbbc8c061b4 (diff)
downloadgdbm-c3dc7294670c91af89e0122c6979de70c63ce4f7.tar.gz
Fix https://puszcza.gnu.org.ua/bugs/index.php?563
-rw-r--r--tools/gdbmshell.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tools/gdbmshell.c b/tools/gdbmshell.c
index 40b5ce7..f3cbae8 100644
--- a/tools/gdbmshell.c
+++ b/tools/gdbmshell.c
@@ -1329,6 +1329,7 @@ snapshot_handler (struct command_param *param, struct command_environ *cenv)
char *sb = tildexpand (PARAM_STRING (param, 1));
char const *sel;
int rc = gdbm_latest_snapshot (sa, sb, &sel);
+ int res;
if (rc >= 0 && rc < ARRAY_SIZE (snapshot_status_info))
{
@@ -1340,13 +1341,17 @@ snapshot_handler (struct command_param *param, struct command_environ *cenv)
snapshot_status_info[rc].fn (cenv->fp, sa, sb);
if (rc == GDBM_SNAPSHOT_OK)
print_snapshot (sel, cenv->fp);
+ res = GDBMSHELL_OK;
}
else
{
terror (_("unexpected error code: %d"), rc);
- return GDBMSHELL_ERR;
+ res = GDBMSHELL_ERR;
}
- return GDBMSHELL_OK;
+
+ free (sa);
+ free (sb);
+ return res;
}