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(); return Undefined();
} else { } else {
if (pos < 0) { written = pos < 0 ? write(fd, buf, len) : pwrite(fd, buf, len, pos);
written = write(fd, buf, len); delete [] reinterpret_cast<char*>(buf);
} else {
written = pwrite(fd, buf, len, pos);
}
if (written < 0) return ThrowException(ErrnoException(errno)); if (written < 0) return ThrowException(ErrnoException(errno));
return scope.Close(Integer::New(written)); return scope.Close(Integer::New(written));
} }

Loading…
Cancel
Save