aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2020-03-03 14:37:47 +0000
committerWerner Koch <[email protected]>2020-03-03 14:37:47 +0000
commit72a15bad8f27303475498ce44e34d29b4c2c4593 (patch)
tree4135e0774ab6416a7986cfe01ad6f231d10ab7a5
parentcore: New internal option --dump-option-table for argparser. (diff)
downloadlibgpg-error-72a15bad8f27303475498ce44e34d29b4c2c4593.tar.gz
libgpg-error-72a15bad8f27303475498ce44e34d29b4c2c4593.zip
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 <[email protected]>
-rw-r--r--src/argparse.c4
1 files changed, 3 insertions, 1 deletions
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;