projects
/
platform
/
upstream
/
nodejs.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
61364f9
)
Fix memory leak in fs.writeSync()
author
Ryan Dahl
<ry@tinyclouds.org>
Mon, 3 May 2010 00:02:13 +0000
(17:02 -0700)
committer
Ryan Dahl
<ry@tinyclouds.org>
Mon, 3 May 2010 00:02:13 +0000
(17:02 -0700)
src/node_file.cc
patch
|
blob
|
history
diff --git
a/src/node_file.cc
b/src/node_file.cc
index
e417819
..
bc48a12
100644
(file)
--- a/
src/node_file.cc
+++ b/
src/node_file.cc
@@
-564,11
+564,8
@@
static Handle<Value> Write(const Arguments& args) {
} else {
if (legacy) {
- 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));
} else {