summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
authorTaylor Blau <me@ttaylorr.com>2021-10-26 21:01:18 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-10-28 22:32:14 (GMT)
commitee4a1d63d7e9bdbea6bbeeb3f82ef33030de9ffb (patch)
treeab2b265884ef943252bfb154218089c4c58addb0 /builtin
parente6432e0f1f183595b265b76ca765c612e705c65a (diff)
downloadgit-ee4a1d63d7e9bdbea6bbeeb3f82ef33030de9ffb.zip
git-ee4a1d63d7e9bdbea6bbeeb3f82ef33030de9ffb.tar.gz
git-ee4a1d63d7e9bdbea6bbeeb3f82ef33030de9ffb.tar.bz2
builtin/multi-pack-index.c: don't leak concatenated options
The `multi-pack-index` builtin dynamically allocates an array of command-line option for each of its separate modes by calling add_common_options() to concatante the common options with sub-command specific ones. Because this operation allocates a new array, we have to be careful to remember to free it. We already do this in the repack and write sub-commands, but verify and expire don't. Rectify this by calling FREE_AND_NULL as the other modes do. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r--builtin/multi-pack-index.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/builtin/multi-pack-index.c b/builtin/multi-pack-index.c
index 075d15d..4480ba3 100644
--- a/builtin/multi-pack-index.c
+++ b/builtin/multi-pack-index.c
@@ -167,6 +167,8 @@ static int cmd_multi_pack_index_verify(int argc, const char **argv)
usage_with_options(builtin_multi_pack_index_verify_usage,
options);
+ FREE_AND_NULL(options);
+
return verify_midx_file(the_repository, opts.object_dir, opts.flags);
}
@@ -191,6 +193,8 @@ static int cmd_multi_pack_index_expire(int argc, const char **argv)
usage_with_options(builtin_multi_pack_index_expire_usage,
options);
+ FREE_AND_NULL(options);
+
return expire_midx_packs(the_repository, opts.object_dir, opts.flags);
}