mirror of
https://git.proxmox.com/git/libgit2
synced 2025-06-23 09:10:46 +00:00
Stop leaking memory
This commit is contained in:
parent
93d8f77fed
commit
6f0b8142e6
@ -1827,10 +1827,15 @@ int git_repository_is_shallow(git_repository *repo)
|
|||||||
{
|
{
|
||||||
git_buf path = GIT_BUF_INIT;
|
git_buf path = GIT_BUF_INIT;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
int error;
|
||||||
|
|
||||||
git_buf_joinpath(&path, repo->path_repository, "shallow");
|
git_buf_joinpath(&path, repo->path_repository, "shallow");
|
||||||
|
error = git_path_lstat(path.ptr, &st);
|
||||||
|
git_buf_free(&path);
|
||||||
|
|
||||||
if (git_path_lstat(path.ptr, &st) == GIT_ENOTFOUND)
|
if (error == GIT_ENOTFOUND)
|
||||||
return 0;
|
return 0;
|
||||||
|
if (error < 0)
|
||||||
|
return -1;
|
||||||
return st.st_size == 0 ? 0 : 1;
|
return st.st_size == 0 ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user