From 72a15bad8f27303475498ce44e34d29b4c2c4593 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Tue, 3 Mar 2020 15:37:47 +0100 Subject: core: Fix allocation bug introduced with last commit. * src/argparse.c (initialize): Increase number of extra slots. -- I should really buy the valgrind authors a beer. Fixes-commit: db95feab16e32309a4bfb382827c495c2c49920c Signed-off-by: Werner Koch --- src/argparse.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/argparse.c b/src/argparse.c index 00ba82a..223d267 100644 --- a/src/argparse.c +++ b/src/argparse.c @@ -370,7 +370,7 @@ initialize (gpgrt_argparse_t *arg, gpgrt_opt_t *opts, estream_t fp) seen_dump_option_table = 1; } } - i += 4; /* The number of the above internal options. */ + i += 5; /* The number of the above internal options. */ i++; /* End of list marker. */ arg->internal->opts = xtrycalloc (i, sizeof *arg->internal->opts); if (!arg->internal->opts) @@ -432,6 +432,8 @@ initialize (gpgrt_argparse_t *arg, gpgrt_opt_t *opts, estream_t fp) arg->internal->opts[i].ordinal = i; i++; } + /* Take care: When adding new options remember to increase the + * size of the array. */ arg->internal->opts[i].short_opt = 0; -- cgit v1.2.1