aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/sparse-checkout.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2024-06-11 11:19:22 +0200
committerJunio C Hamano <gitster@pobox.com>2024-06-11 13:15:04 -0700
commit14da26230a7644a2f9dfbc3f43d9d7ab6e0074e9 (patch)
tree600341b6864236888a6508a79bf46e97436ded8b /builtin/sparse-checkout.c
parentrevision: fix memory leak when reversing revisions (diff)
downloadgit-14da26230a7644a2f9dfbc3f43d9d7ab6e0074e9.tar.gz
git-14da26230a7644a2f9dfbc3f43d9d7ab6e0074e9.zip
parse-options: fix leaks for users of OPT_FILENAME
The `OPT_FILENAME()` option will, if set, put an allocated string into the user-provided variable. Consequently, that variable thus needs to be free'd by the caller of `parse_options()`. Some callsites don't though and thus leak memory. Fix those. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/sparse-checkout.c')
-rw-r--r--builtin/sparse-checkout.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/builtin/sparse-checkout.c b/builtin/sparse-checkout.c
index 0f52e25249..84a6adf681 100644
--- a/builtin/sparse-checkout.c
+++ b/builtin/sparse-checkout.c
@@ -1011,6 +1011,7 @@ static int sparse_checkout_check_rules(int argc, const char **argv, const char *
ret = check_rules(&pl, check_rules_opts.null_termination);
clear_pattern_list(&pl);
+ free(check_rules_opts.rules_file);
return ret;
}