Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[squash] fix stupid memory leak, un-tank performance
  • Loading branch information
addaleax committed Feb 13, 2018
commit 98de11a71a6a0ea702a656a037d1e54e3dc74f35
6 changes: 6 additions & 0 deletions src/stream_base.cc
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,12 @@ int StreamBase::WriteString(const FunctionCallbackInfo<Value>& args) {
Integer::NewFromUnsigned(env->isolate(), data_size))
.FromJust();

if (res.wrap != nullptr) {
res.wrap->SetAllocatedStorage(data, data_size);
} else {
free(data);
}

return res.err;
}

Expand Down