dir: Don't leak a buffer on a failed Enumerate

If, for some reasons, Enumerate encounters a hash object with a NULL
buffer pointer, that's no reason to leak the hash object. Make sure
that we DRelease it before failing

Change-Id: I9ba6c69ca524937a6068d33a0ec0a90eef5b88ea
Reviewed-on: http://gerrit.openafs.org/5659
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
Simon Wilkinson 2011-10-23 16:38:13 +01:00 committed by Derrick Brashear
parent a9924ba433
commit 3f938315ad

View File

@ -433,8 +433,10 @@ afs_dir_EnumerateDir(dir_file_t dir, int (*proc) (void *, char *name,
goto out;
ep = (struct DirEntry *)entrybuf.data;
if (!ep)
if (!ep) {
DRelease(&entrybuf, 0);
break;
}
num = ntohs(ep->next);
code = (*proc) (hook, ep->name, ntohl(ep->fid.vnode),