Browse Source

Allocations with new[] must be freed with delete[].

See http://valgrind.org/docs/manual/mc-manual.html#mc-manual.rudefn
v0.7.4-release
Tom Hughes 14 years ago
committed by Ryan Dahl
parent
commit
6285fac232
  1. 2
      src/node_buffer.cc

2
src/node_buffer.cc

@ -176,7 +176,7 @@ void Buffer::Replace(char *data, size_t length,
if (callback_) { if (callback_) {
callback_(data_, callback_hint_); callback_(data_, callback_hint_);
} else if (length_) { } else if (length_) {
delete data_; delete [] data_;
V8::AdjustAmountOfExternalAllocatedMemory(-(sizeof(Buffer) + length_)); V8::AdjustAmountOfExternalAllocatedMemory(-(sizeof(Buffer) + length_));
} }

Loading…
Cancel
Save