Skip to content

Commit 2181fe6

Browse files
peffgitster
authored andcommitted
sparse-checkout: free string list in write_cone_to_file()
We use a string list to hold sorted and de-duped patterns, but don't free it before leaving the function, causing a leak. This drops the number of leaks found in t7002 from 27 to 25. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 94d25d3 commit 2181fe6

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

builtin/sparse-checkout.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ static void write_cone_to_file(FILE *fp, struct pattern_list *pl)
311311
fprintf(fp, "%s/\n", pattern);
312312
free(pattern);
313313
}
314+
315+
string_list_clear(&sl, 0);
314316
}
315317

316318
static int write_patterns_and_update(struct pattern_list *pl)

0 commit comments

Comments
 (0)