summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2014-10-25 19:53:53 -0400
committerEdward Thomson <ethomson@microsoft.com>2014-10-26 22:28:00 -0400
commit5a7cd1bcc057d8a6845dbf6c9aaa221d0fd2f0f4 (patch)
treea6bc48c4983b6f1cb8160169d34b50408cb029ec
parent4b1b2bd9eb5ddfed32b509871fba30433a895ec9 (diff)
downloadlibgit2-5a7cd1bcc057d8a6845dbf6c9aaa221d0fd2f0f4.tar.gz
iterator: free paths when skipping them
-rw-r--r--src/path.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/path.c b/src/path.c
index 143c564e8..effe2fff1 100644
--- a/src/path.c
+++ b/src/path.c
@@ -1198,7 +1198,9 @@ int git_path_dirload_with_stat(
if (error == GIT_ENOTFOUND) {
/* file was removed between readdir and lstat */
+ char *entry_path = git_vector_get(contents, i);
git_vector_remove(contents, i--);
+ git__free(entry_path);
} else {
/* Treat the file as unreadable if we get any other error */
memset(&ps->st, 0, sizeof(ps->st));
@@ -1215,8 +1217,9 @@ int git_path_dirload_with_stat(
ps->path[ps->path_len] = '\0';
}
else if (!S_ISREG(ps->st.st_mode) && !S_ISLNK(ps->st.st_mode)) {
- /* skip everything but dirs, plain files, and symlinks */
+ char *entry_path = git_vector_get(contents, i);
git_vector_remove(contents, i--);
+ git__free(entry_path);
}
}