Skip to content
This repository has been archived by the owner on Jul 6, 2018. It is now read-only.

Commit

Permalink
http2: fixup SessionSendBuffer impl (Squash)
Browse files Browse the repository at this point in the history
The WriteWrap impl details changed slightly. Fixup
the cleanup logic for SessionSendBuffer class in
node_http2.h accordingly.
  • Loading branch information
jasnell committed May 31, 2017
1 parent 1dc30e5 commit ee243e4
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/node_http2.h
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,9 @@ class SessionShutdownWrap : public ReqWrap<uv_idle_t> {
class SessionSendBuffer : public WriteWrap {
public:
static void OnDone(WriteWrap* req, int status) {
::delete req;
SessionSendBuffer* wrap =
static_cast<SessionSendBuffer*>(req);
wrap->cleanup();
}

SessionSendBuffer(Environment* env,
Expand All @@ -565,13 +567,15 @@ class SessionSendBuffer : public WriteWrap {
buffer_ = uv_buf_init(new char[size], size);
}

~SessionSendBuffer() {
delete[] buffer_.base;
}
~SessionSendBuffer() {}

uv_buf_t buffer_;

protected:
void cleanup() {
delete[] buffer_.base;
}

// This is just to avoid the compiler error. This should not be called
void operator delete(void* ptr) { UNREACHABLE(); }
};
Expand Down

0 comments on commit ee243e4

Please sign in to comment.