diff --git a/src/node_file.cc b/src/node_file.cc index e417819138..bc48a1258f 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -564,11 +564,8 @@ static Handle 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(buf); if (written < 0) return ThrowException(ErrnoException(errno)); return scope.Close(Integer::New(written)); } else {