diff --git a/src/unix/fs.c b/src/unix/fs.c index bd0d0bea..92e2d255 100644 --- a/src/unix/fs.c +++ b/src/unix/fs.c @@ -75,6 +75,7 @@ req->loop = loop; \ req->path = NULL; \ req->new_path = NULL; \ + req->bufs = NULL; \ req->cb = cb; \ } \ while (0) @@ -1485,6 +1486,10 @@ void uv_fs_req_cleanup(uv_fs_t* req) { if (req->fs_type == UV_FS_SCANDIR && req->ptr != NULL) uv__fs_scandir_cleanup(req); + if (req->bufs != req->bufsml) + uv__free(req->bufs); + req->bufs = NULL; + if (req->ptr != &req->statbuf) uv__free(req->ptr); req->ptr = NULL; diff --git a/src/win/fs.c b/src/win/fs.c index 097b00e0..6e0bdc7b 100644 --- a/src/win/fs.c +++ b/src/win/fs.c @@ -245,6 +245,7 @@ INLINE static void uv_fs_req_init(uv_loop_t* loop, uv_fs_t* req, req->ptr = NULL; req->path = NULL; req->cb = cb; + req->fs.info.bufs = NULL; memset(&req->fs, 0, sizeof(req->fs)); }