diff --git a/src/env-inl.h b/src/env-inl.h index 267567d80cdfaa..63b71daf15a245 100644 --- a/src/env-inl.h +++ b/src/env-inl.h @@ -743,8 +743,7 @@ inline AllocatedBuffer::AllocatedBuffer(Environment* env, uv_buf_t buf) inline void AllocatedBuffer::Resize(size_t len) { char* new_data = env_->Reallocate(buffer_.base, buffer_.len, len); CHECK_IMPLIES(len > 0, new_data != nullptr); - buffer_.base = new_data; - buffer_.len = len; + buffer_ = uv_buf_init(new_data, len); } inline uv_buf_t AllocatedBuffer::release() { diff --git a/src/env.h b/src/env.h index b2e4b2bc7e4079..3856f5241d63b6 100644 --- a/src/env.h +++ b/src/env.h @@ -501,6 +501,8 @@ struct AllocatedBuffer { private: Environment* env_; + // We do not pass this to libuv directly, but uv_buf_t is a convenient way + // to represent a chunk of memory, and plays nicely with other parts of core. uv_buf_t buffer_; friend class Environment;