Browse Source

delete[] instead of delete for arrays.

v0.7.4-release
Ryan Dahl 15 years ago
parent
commit
663deb3828
  1. 2
      src/child_process.cc
  2. 2
      src/file.cc
  3. 2
      src/net.cc
  4. 4
      src/node.cc

2
src/child_process.cc

@ -79,7 +79,7 @@ Handle<Value> ChildProcess::Write(const Arguments& args) {
ssize_t written = DecodeWrite(buf, len, args[0], enc); ssize_t written = DecodeWrite(buf, len, args[0], enc);
assert(written == len); assert(written == len);
int r = child->Write(buf, len); int r = child->Write(buf, len);
delete buf; delete [] buf;
return r == 0 ? True() : False(); return r == 0 ? True() : False();
} }

2
src/file.cc

@ -146,7 +146,7 @@ EIOPromise::After (eio_req *req)
argc = 1; argc = 1;
argv[0] = Integer::New(req->result); argv[0] = Integer::New(req->result);
assert(req->ptr2); assert(req->ptr2);
delete req->ptr2; delete [] req->ptr2;
break; break;
case EIO_STAT: case EIO_STAT:

2
src/net.cc

@ -356,7 +356,7 @@ Handle<Value> Connection::Send(const Arguments& args) {
ssize_t written = DecodeWrite(buf, len, args[0], enc); ssize_t written = DecodeWrite(buf, len, args[0], enc);
assert(written == len); assert(written == len);
connection->Send(buf, written); connection->Send(buf, written);
delete buf; delete [] buf;
return scope.Close(Integer::New(written)); return scope.Close(Integer::New(written));
} }

4
src/node.cc

@ -69,7 +69,7 @@ Local<Value> Encode(const void *buf, size_t len, enum encoding encoding) {
twobytebuf[i] = cbuf[i]; twobytebuf[i] = cbuf[i];
} }
Local<String> chunk = String::New(twobytebuf, len); Local<String> chunk = String::New(twobytebuf, len);
delete twobytebuf; // TODO use ExternalTwoByteString? delete [] twobytebuf; // TODO use ExternalTwoByteString?
return scope.Close(chunk); return scope.Close(chunk);
} }
@ -146,7 +146,7 @@ ssize_t DecodeWrite(char *buf, size_t buflen,
buf[i] = b[0]; buf[i] = b[0];
} }
delete twobytebuf; delete [] twobytebuf;
return buflen; return buflen;
} }

Loading…
Cancel
Save