checkout: fix resource leak
diff --git a/src/checkout.c b/src/checkout.c
index a92ad08..fd8e2c4 100644
--- a/src/checkout.c
+++ b/src/checkout.c
@@ -1487,8 +1487,10 @@ static int blob_content_to_file(
if (!data->opts.disable_filters &&
(error = git_filter_list__load_ext(
&fl, data->repo, blob, hint_path,
- GIT_FILTER_TO_WORKTREE, &filter_opts)))
+ GIT_FILTER_TO_WORKTREE, &filter_opts))) {
+ p_close(fd);
return error;
+ }
/* setup the writer */
memset(&writer, 0, sizeof(struct checkout_stream));