diff options
author | Ben Straub <bs@github.com> | 2013-05-23 17:28:52 -0700 |
---|---|---|
committer | Ben Straub <bs@github.com> | 2013-05-23 17:28:52 -0700 |
commit | 6f0b8142e65b43f2224027a7abc67116ab6ad1a7 (patch) | |
tree | 6718f03ba9fd00efd53be29a2ebc65563359a2ec | |
parent | 93d8f77fed9407421ba1c90141d997b2dea7e0e7 (diff) | |
download | libgit2-6f0b8142e65b43f2224027a7abc67116ab6ad1a7.tar.gz |
Stop leaking memory
-rw-r--r-- | src/repository.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/repository.c b/src/repository.c index b0359a58f..28505e822 100644 --- a/src/repository.c +++ b/src/repository.c @@ -1827,10 +1827,15 @@ int git_repository_is_shallow(git_repository *repo) { git_buf path = GIT_BUF_INIT; struct stat st; + int error; 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; + if (error < 0) + return -1; return st.st_size == 0 ? 0 : 1; } |