Skip to content

Commit 9ce2144

Browse files
committed
Merge branch 'ly/prepare-show-merge-leakfix' into jch
* ly/prepare-show-merge-leakfix: revision: fix memory leak in prepare_show_merge()
2 parents 48deb1f + a3d278b commit 9ce2144

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

revision.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2061,6 +2061,7 @@ static void prepare_show_merge(struct rev_info *revs)
20612061
parse_pathspec(&revs->prune_data, PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL,
20622062
PATHSPEC_PREFER_FULL | PATHSPEC_LITERAL_PATH, "", prune);
20632063
revs->limited = 1;
2064+
free(prune);
20642065
}
20652066

20662067
static int dotdot_missing(const char *arg, char *dotdot,

t/t7007-show.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,4 +167,28 @@ test_expect_success 'show --graph is forbidden' '
167167
test_must_fail git show --graph HEAD
168168
'
169169

170+
test_expect_success 'show unmerged index' '
171+
git reset --hard &&
172+
173+
git switch -C base &&
174+
echo "base" >conflicting &&
175+
git add conflicting &&
176+
git commit -m "base" &&
177+
178+
git branch hello &&
179+
git branch goodbye &&
180+
181+
git switch hello &&
182+
echo "hello" >conflicting &&
183+
git commit -am "hello" &&
184+
185+
git switch goodbye &&
186+
echo "goodbye" >conflicting &&
187+
git commit -am "goodbye" &&
188+
189+
git switch hello &&
190+
test_must_fail git merge goodbye &&
191+
git show --merge HEAD
192+
'
193+
170194
test_done

0 commit comments

Comments
 (0)