From 32f1c74166b04b4cb4d2bd057c23a575d4b2d24e Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Mon, 9 Aug 2021 09:54:19 +0300 Subject: Make parseopt reentrant. * src/parseopt.c (parseopt_first): Initialize option tables to NULL. --- src/parseopt.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/parseopt.c b/src/parseopt.c index d291632..bc47597 100644 --- a/src/parseopt.c +++ b/src/parseopt.c @@ -193,10 +193,13 @@ int parseopt_first (int pc, char **pv, struct gdbm_option *opts) { free (option_tab); + option_tab = NULL; free (short_options); + short_options = NULL; short_option_count = short_option_max = 0; #ifdef HAVE_GETOPT_LONG free (long_options); + long_options = NULL; long_option_count = long_option_max = 0; #endif add_options (opts); -- cgit v1.2.1