From: Junio C Hamano Date: Wed, 30 Mar 2016 17:19:09 GMT Subject: Re: [PATCH 5/6] bundle: don't leak an fd in case of early return Message-ID: In-Reply-To: <20160330011743.GD2237@sigill.intra.peff.net> Jeff King writes: >> + if (compute_and_write_prerequisites(bundle_fd, &revs, argc, argv)) { >> + if (!bundle_to_stdout) >> + close(bundle_fd); >> return -1; >> + } > > Makes sense. Should we also be rolling back the lock file? It happens > automatically at program exit, of course, but we are in library code > here that should not rely on that. Yeah, I agree. I suspect that the original wasn't even meant to be used in a "library-ish" fashion, but as long as we are adding this close(), we should also be doing the rollback. Thanks.