diff options
| author | Patrick Steinhardt <ps@pks.im> | 2024-09-30 11:13:27 +0200 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2024-09-30 11:23:03 -0700 |
| commit | 5cca114973c602c9f8516e9ed34c76fd75fb999e (patch) | |
| tree | 2fc75d716b6d40bebc2cdd0345c765d21a498efd /branch.c | |
| parent | wt-status: fix leaking buffer with sparse directories (diff) | |
| download | git-5cca114973c602c9f8516e9ed34c76fd75fb999e.tar.gz git-5cca114973c602c9f8516e9ed34c76fd75fb999e.zip | |
submodule: fix leaking submodule entry list
The submodule entry list returned by `submodules_of_tree()` is never
completely free'd by its only caller. Introduce a new function that
free's the list for us and call it.
While at it, also fix the leaking `branch_point` string.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'branch.c')
| -rw-r--r-- | branch.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -738,6 +738,7 @@ static int submodule_create_branch(struct repository *r, strbuf_release(&child_err); strbuf_release(&out_buf); + free(out_prefix); return ret; } @@ -794,7 +795,7 @@ void create_branches_recursively(struct repository *r, const char *name, create_branch(r, name, start_committish, force, 0, reflog, quiet, BRANCH_TRACK_NEVER, dry_run); if (dry_run) - return; + goto out; /* * NEEDSWORK If tracking was set up in the superproject but not the * submodule, users might expect "git branch --recurse-submodules" to @@ -815,8 +816,11 @@ void create_branches_recursively(struct repository *r, const char *name, die(_("submodule '%s': cannot create branch '%s'"), submodule_entry_list.entries[i].submodule->name, name); - repo_clear(submodule_entry_list.entries[i].repo); } + +out: + submodule_entry_list_release(&submodule_entry_list); + free(branch_point); } void remove_merge_branch_state(struct repository *r) |
