mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-06 17:54:05 +00:00
Fix double-freeing file descriptors
Was crashing the Windows build. Signed-off-by: Vicent Marti <tanoku@gmail.com>
This commit is contained in:
parent
fc658755bf
commit
c3be146840
@ -72,10 +72,11 @@ static int lock_file(git_filebuf *file, int flags)
|
|||||||
|
|
||||||
void git_filebuf_cleanup(git_filebuf *file)
|
void git_filebuf_cleanup(git_filebuf *file)
|
||||||
{
|
{
|
||||||
if (file->fd >= 0) {
|
if (file->fd >= 0)
|
||||||
gitfo_close(file->fd);
|
gitfo_close(file->fd);
|
||||||
|
|
||||||
|
if (gitfo_exists(file->path_lock) == GIT_SUCCESS)
|
||||||
gitfo_unlink(file->path_lock);
|
gitfo_unlink(file->path_lock);
|
||||||
}
|
|
||||||
|
|
||||||
if (file->digest)
|
if (file->digest)
|
||||||
git_hash_free_ctx(file->digest);
|
git_hash_free_ctx(file->digest);
|
||||||
@ -192,6 +193,8 @@ int git_filebuf_commit(git_filebuf *file)
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
gitfo_close(file->fd);
|
gitfo_close(file->fd);
|
||||||
|
file->fd = -1;
|
||||||
|
|
||||||
error = gitfo_move_file(file->path_lock, file->path_original);
|
error = gitfo_move_file(file->path_lock, file->path_original);
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
Loading…
Reference in New Issue
Block a user