Skip to content

Commit 6660b42

Browse files
committed
Merge branch 'ly/am-split-stgit-leakfix'
Leakfix. * ly/am-split-stgit-leakfix: builtin/am: fix memory leak in `split_mail_stgit_series`
2 parents effbd42 + e5dd0a0 commit 6660b42

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

builtin/am.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -850,8 +850,10 @@ static int split_mail_stgit_series(struct am_state *state, const char **paths,
850850
series_dir = dirname(series_dir_buf);
851851

852852
fp = fopen(*paths, "r");
853-
if (!fp)
853+
if (!fp) {
854+
free(series_dir_buf);
854855
return error_errno(_("could not open '%s' for reading"), *paths);
856+
}
855857

856858
while (!strbuf_getline_lf(&sb, fp)) {
857859
if (*sb.buf == '#')

0 commit comments

Comments
 (0)