From eab8bebcedd2d6ae46a25166964974bca263e616 Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Wed, 27 Jul 2011 13:58:39 -0700 Subject: [PATCH] Fix memleak in libeio. --- deps/libeio/eio.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/deps/libeio/eio.c b/deps/libeio/eio.c index 1929cf6eead..3057152489f 100644 --- a/deps/libeio/eio.c +++ b/deps/libeio/eio.c @@ -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);