mirror of https://github.com/nodejs/node.git
Bugfix: node.fs.write() was stack allocating buffer.
Since the buffer is passed to the thread pool it needs to be heap allocated. Thanks to Jon Crosby and Tim Caswell for debugging this.pull/22966/head
parent
e57c16bc2d
commit
b54fad9b3f
|
@ -138,9 +138,15 @@ EIOPromise::After (eio_req *req)
|
|||
break;
|
||||
|
||||
case EIO_OPEN:
|
||||
argc = 1;
|
||||
argv[0] = Integer::New(req->result);
|
||||
break;
|
||||
|
||||
case EIO_WRITE:
|
||||
argc = 1;
|
||||
argv[0] = Integer::New(req->result);
|
||||
assert(req->ptr2);
|
||||
delete req->ptr2;
|
||||
break;
|
||||
|
||||
case EIO_STAT:
|
||||
|
@ -336,7 +342,8 @@ Write (const Arguments& args)
|
|||
Local<Value> exception = Exception::TypeError(String::New("Bad argument"));
|
||||
return ThrowException(exception);
|
||||
}
|
||||
char buf[len];
|
||||
|
||||
char * buf = new char[len];
|
||||
ssize_t written = DecodeWrite(buf, len, args[1], enc);
|
||||
assert(written == len);
|
||||
|
||||
|
|
Loading…
Reference in New Issue