mirror of
https://git.proxmox.com/git/libgit2
synced 2025-05-08 10:53:16 +00:00
iterator: free paths when skipping them
This commit is contained in:
parent
4b1b2bd9eb
commit
5a7cd1bcc0
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user