]> git.proxmox.com Git - libgit2.git/commitdiff
Stop leaking memory
authorBen Straub <bs@github.com>
Fri, 24 May 2013 00:28:52 +0000 (17:28 -0700)
committerBen Straub <bs@github.com>
Fri, 24 May 2013 00:28:52 +0000 (17:28 -0700)
src/repository.c

index b0359a58f9c6f22c43f408298e1af8da65bf94a0..28505e82253ca85eab0b5917d8b41a6adf541e63 100644 (file)
@@ -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;
 }