gdbm/Fix-gdbmtool-import-command.patch
2021-11-25 11:37:28 +08:00

37 lines
1.1 KiB
Diff

From 4f456e7c4b9e3727a83bc3d30ac929402f7ef81a Mon Sep 17 00:00:00 2001
From: yangchenguang <yangchenguang@uniontech.com>
Date: Fri, 19 Nov 2021 10:44:24 +0800
Subject: [PATCH] Fix gdbmtool import command
* src/gdbmtool.c (import_handler): Fix option addressing (see
https://puszcza.gnu.org.ua/bugs/?535).
Fix freeing of the uninitialized variable.
---
src/gdbmtool.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/gdbmtool.c b/src/gdbmtool.c
index bbadbae..03ba482 100644
--- a/src/gdbmtool.c
+++ b/src/gdbmtool.c
@@ -1003,7 +1003,7 @@ import_handler (struct handler_param *param)
int i;
int rc;
- 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;
@@ -1054,7 +1054,6 @@ import_handler (struct handler_param *param)
return;
}
- free (file_name);
if (gdbm_setopt (gdbm_file, GDBM_GETDBNAME, &file_name, sizeof (file_name)))
terror (_("gdbm_setopt failed: %s"), gdbm_strerror (gdbm_errno));
}
--
2.20.1