From: Lidong Yan <502024330056@xxxxxxxxxxxxxxxx> 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 <502024330056@xxxxxxxxxxxxxxxx> --- 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(). Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1989%2Fbrandb97%2Ffix-revision-leak-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1989/brandb97/fix-revision-leak-v1 Pull-Request: https://github.com/git/git/pull/1989 revision.c | 1 + 1 file changed, 1 insertion(+) diff --git a/revision.c b/revision.c index 2c36a9c179e..afee1111961 100644 --- a/revision.c +++ b/revision.c @@ -2060,6 +2060,7 @@ static void prepare_show_merge(struct rev_info *revs) parse_pathspec(&revs->prune_data, PATHSPEC_ALL_MAGIC & ~PATHSPEC_LITERAL, PATHSPEC_PREFER_FULL | PATHSPEC_LITERAL_PATH, "", prune); revs->limited = 1; + free(prune); } static int dotdot_missing(const char *arg, char *dotdot, base-commit: 7014b55638da979331baf8dc31c4e1d697cf2d67 -- gitgitgadget