Commit 1af80a67 by Russell Belfer

Fix workdir iterator leak

When attempting to create a workdir iterator for a bare repo,
don't leak the iterator structure.
parent 38fd8121
...@@ -1252,16 +1252,14 @@ int git_iterator_for_workdir( ...@@ -1252,16 +1252,14 @@ int git_iterator_for_workdir(
const char *end) const char *end)
{ {
int error; int error;
workdir_iterator *wi = git__calloc(1, sizeof(workdir_iterator)); workdir_iterator *wi;
GITERR_CHECK_ALLOC(wi);
assert(out && repo);
if ((error = git_repository__ensure_not_bare( if (git_repository__ensure_not_bare(repo, "scan working directory") < 0)
repo, "scan working directory")) < 0) return GIT_EBAREREPO;
return error;
/* initialize as an fs iterator then do overrides */ /* initialize as an fs iterator then do overrides */
wi = git__calloc(1, sizeof(workdir_iterator));
GITERR_CHECK_ALLOC(wi);
ITERATOR_BASE_INIT((&wi->fi), fs, FS, repo); ITERATOR_BASE_INIT((&wi->fi), fs, FS, repo);
wi->fi.base.type = GIT_ITERATOR_TYPE_WORKDIR; wi->fi.base.type = GIT_ITERATOR_TYPE_WORKDIR;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment