mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-08 07:58:22 +00:00
attr_file: fix resource leak
This commit is contained in:
parent
e262545753
commit
24b8ed2b3a
@ -123,7 +123,7 @@ int git_attr_file__load(
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GIT_ATTR_FILE__FROM_FILE: {
|
case GIT_ATTR_FILE__FROM_FILE: {
|
||||||
int fd;
|
int fd = -1;
|
||||||
|
|
||||||
/* For open or read errors, pretend that we got ENOTFOUND. */
|
/* For open or read errors, pretend that we got ENOTFOUND. */
|
||||||
/* TODO: issue warning when warning API is available */
|
/* TODO: issue warning when warning API is available */
|
||||||
@ -133,7 +133,8 @@ int git_attr_file__load(
|
|||||||
(fd = git_futils_open_ro(entry->fullpath)) < 0 ||
|
(fd = git_futils_open_ro(entry->fullpath)) < 0 ||
|
||||||
(error = git_futils_readbuffer_fd(&content, fd, (size_t)st.st_size)) < 0)
|
(error = git_futils_readbuffer_fd(&content, fd, (size_t)st.st_size)) < 0)
|
||||||
nonexistent = true;
|
nonexistent = true;
|
||||||
else
|
|
||||||
|
if (fd >= 0)
|
||||||
p_close(fd);
|
p_close(fd);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user