diff options
author | Patrick Steinhardt <ps@pks.im> | 2024-11-05 07:17:09 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2024-11-04 22:37:53 -0800 |
commit | d34b5cbf028ffda45928e50884a6ef3aa533e6e5 (patch) | |
tree | a4ec5adac43d838ce0e8d99cb2745b83a0a858b7 /builtin/commit.c | |
parent | 3b373150c8ea52ed64db0e7b0bd5a9b483e99a8e (diff) |
builtin/commit: fix leaking change data contents
While we free the worktree change data, we never free its contents. Fix
this.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/commit.c')
-rw-r--r-- | builtin/commit.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/builtin/commit.c b/builtin/commit.c index 8db4e9df0c..18a55bd1b9 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -728,6 +728,13 @@ static void prepare_amend_commit(struct commit *commit, struct strbuf *sb, repo_unuse_commit_buffer(the_repository, commit, buffer); } +static void change_data_free(void *util, const char *str UNUSED) +{ + struct wt_status_change_data *d = util; + free(d->rename_source); + free(d); +} + static int prepare_to_commit(const char *index_file, const char *prefix, struct commit *current_head, struct wt_status *s, @@ -991,7 +998,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix, s->use_color = 0; committable = run_status(s->fp, index_file, prefix, 1, s); s->use_color = saved_color_setting; - string_list_clear(&s->change, 1); + string_list_clear_func(&s->change, change_data_free); } else { struct object_id oid; const char *parent = "HEAD"; |