Commit e26254575306abbc39acd96c6dc54a07aa3b2aa4

Patrick Steinhardt 2016-02-09T11:07:50

checkout: fix resource leak

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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));