Skip to content

Commit 5d0b9bf

Browse files
stefanbellergitster
authored andcommitted
commit.c: fix a memory leak
Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent e280888 commit 5d0b9bf

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

builtin/commit.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ static int commit_index_files(void)
229229
static int list_paths(struct string_list *list, const char *with_tree,
230230
const char *prefix, const struct pathspec *pattern)
231231
{
232-
int i;
232+
int i, ret;
233233
char *m;
234234

235235
if (!pattern->nr)
@@ -256,7 +256,9 @@ static int list_paths(struct string_list *list, const char *with_tree,
256256
item->util = item; /* better a valid pointer than a fake one */
257257
}
258258

259-
return report_path_error(m, pattern, prefix);
259+
ret = report_path_error(m, pattern, prefix);
260+
free(m);
261+
return ret;
260262
}
261263

262264
static void add_remove_files(struct string_list *list)

0 commit comments

Comments
 (0)