Permalink
Browse files

Fix memory leak on fs.write()

Reported by onne@onnlucky.com.
  • Loading branch information...
1 parent 8be6a89 commit 1cacb50f2bf9465c7919a3c4be96aee409355dec @ry ry committed Nov 21, 2009
Showing with 4 additions and 0 deletions.
  1. +4 −0 src/node_file.cc
View
@@ -118,6 +118,10 @@ int EIOPromise::After(eio_req *req) {
Local<Value> 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;
}

0 comments on commit 1cacb50

Please sign in to comment.