commit.c: fix a memory leak
Signed-off-by: Stefan Beller <sbeller@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Stefan Beller committed
Mar 20, 2015 at 17:28 UTC
5d0b9bf86d98b690e443b266e95add7fab334f14
1 file changed
+4
-2
builtin/commit.c
+4
-2
@@ -229,7 +229,7 @@ static int commit_index_files(void)
229
static int list_paths(struct string_list *list, const char *with_tree,
230
const char *prefix, const struct pathspec *pattern)
231
{
232
- int i;
232
+ int i, ret;
233
char *m;
234
235
if (!pattern->nr)
@@ -256,7 +256,9 @@ static int list_paths(struct string_list *list, const char *with_tree,
256
item->util = item; /* better a valid pointer than a fake one */
257
}
258
259
- return report_path_error(m, pattern, prefix);
259
+ ret = report_path_error(m, pattern, prefix);
260
+ free(m);
261
+ return ret;
262
}
263
264
static void add_remove_files(struct string_list *list)