Commit 58f4661
committed
submodule: fix cwd leak in get_superproject_working_tree()
get_superproject_working_tree() allocates cwd via xgetcwd() at
the top of the function, but two early-return paths (when not
inside a work tree, and when strbuf_realpath for "../" fails)
return 0 without freeing it.
Redirect these early returns through a cleanup label that frees
cwd before returning.
Pointed out by Coverity.
Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>1 parent 48598aa commit 58f4661
1 file changed
Lines changed: 6 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2626 | 2626 | | |
2627 | 2627 | | |
2628 | 2628 | | |
2629 | | - | |
| 2629 | + | |
2630 | 2630 | | |
2631 | 2631 | | |
2632 | | - | |
| 2632 | + | |
2633 | 2633 | | |
2634 | 2634 | | |
2635 | 2635 | | |
| |||
2692 | 2692 | | |
2693 | 2693 | | |
2694 | 2694 | | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
2695 | 2699 | | |
2696 | 2700 | | |
2697 | 2701 | | |
| |||
0 commit comments