Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Fix memleak in libeio.
Browse files Browse the repository at this point in the history
  • Loading branch information
thughes authored and bnoordhuis committed Jul 27, 2011
1 parent 2d65f3c commit eab8beb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions deps/libeio/eio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,10 @@ eio__scandir (eio_req *req, etp_worker *self)
X_LOCK (wrklock);
/* the corresponding closedir is in ETP_WORKER_CLEAR */
self->dirp = dirp = opendir (req->ptr1);

if (req->flags & EIO_FLAG_PTR1_FREE)
free (req->ptr1);

req->flags |= EIO_FLAG_PTR1_FREE | EIO_FLAG_PTR2_FREE;
req->ptr1 = dents = flags ? malloc (dentalloc * sizeof (eio_dirent)) : 0;
req->ptr2 = names = malloc (namesalloc);
Expand Down

0 comments on commit eab8beb

Please sign in to comment.