Skip to content

Commit

Permalink
Fix memory leak with fs.writeSync
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed May 3, 2010
1 parent b5bdf94 commit 7a9c81d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 7a9c81d

Please sign in to comment.