Skip to content

Commit 5d213e2

Browse files
committed
revision: fix memory leak in prepare_show_merge()
In revision.c:prepare_show_merge(), we allocated an array in prune but forget to free it. Since parse_pathspec is not responsible to free prune, we should add `free(prune)` in the end of prepare_show_merge(). Signed-off-by: Lidong Yan <[email protected]>
1 parent 7014b55 commit 5d213e2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

revision.c

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

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

0 commit comments

Comments
 (0)