Skip to content

Commit 1cacb50

Browse files
committed
Fix memory leak on fs.write()
Reported by onne@onnlucky.com.
1 parent 8be6a89 commit 1cacb50

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

src/node_file.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,10 @@ int EIOPromise::After(eio_req *req) {
118118
Local<Value> exception = Exception::Error(
119119
String::NewSymbol(strerror(req->errorno)));
120120
promise->EmitError(1, &exception);
121+
if (req->type == EIO_WRITE) {
122+
assert(req->ptr2);
123+
delete [] req->ptr2;
124+
}
121125
return 0;
122126
}
123127

0 commit comments

Comments
 (0)