Merge branch 'ly/am-split-stgit-leakfix'

Leakfix.

* ly/am-split-stgit-leakfix:
  builtin/am: fix memory leak in `split_mail_stgit_series`
This commit is contained in:
Junio C Hamano
2025-05-19 16:02:46 -07:00

View File

@@ -850,8 +850,10 @@ static int split_mail_stgit_series(struct am_state *state, const char **paths,
series_dir = dirname(series_dir_buf);
fp = fopen(*paths, "r");
if (!fp)
if (!fp) {
free(series_dir_buf);
return error_errno(_("could not open '%s' for reading"), *paths);
}
while (!strbuf_getline_lf(&sb, fp)) {
if (*sb.buf == '#')