]> git.ipfire.org Git - thirdparty/git.git/commit - bundle.c
bundle: don't leak an fd in case of early return
authorStefan Beller <sbeller@google.com>
Fri, 1 Apr 2016 00:35:45 +0000 (17:35 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 1 Apr 2016 17:33:18 +0000 (10:33 -0700)
commitf5ff5fb56485979895cff5954e4db1ea4ff4c9f7
treeaa810c8328b154a0e38410e6e6c653de4dbbe34b
parent6eb6078bf5fd08028b21d80b9062a4aed83a2340
bundle: don't leak an fd in case of early return

In successful operation `write_pack_data` will close the `bundle_fd`,
but when we exit early, we need to take care of the file descriptor
as well as the lock file ourselves. The lock file may be deleted at the
end of running the program, but we are in library code, so we should
not rely on that.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
bundle.c