Browse Source

Fix memory leak with fs.writeSync

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
7a9c81d2dc
  1. 7
      src/node_file.cc

7
src/node_file.cc

@ -556,11 +556,8 @@ static Handle<Value> Write(const Arguments& args) {
return Undefined();
} else {
if (pos < 0) {
written = write(fd, buf, len);
} else {
written = pwrite(fd, buf, len, pos);
}
written = pos < 0 ? write(fd, buf, len) : pwrite(fd, buf, len, pos);
delete [] reinterpret_cast<char*>(buf);
if (written < 0) return ThrowException(ErrnoException(errno));
return scope.Close(Integer::New(written));
}

Loading…
Cancel
Save