From 1cacb50f2bf9465c7919a3c4be96aee409355dec Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Sun, 22 Nov 2009 00:47:26 +0100 Subject: [PATCH] Fix memory leak on fs.write() Reported by onne@onnlucky.com. --- src/node_file.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/node_file.cc b/src/node_file.cc index f4cda23580..399ec88dd7 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -118,6 +118,10 @@ int EIOPromise::After(eio_req *req) { Local exception = Exception::Error( String::NewSymbol(strerror(req->errorno))); promise->EmitError(1, &exception); + if (req->type == EIO_WRITE) { + assert(req->ptr2); + delete [] req->ptr2; + } return 0; }