stream: do not leak alloc_cb buffers on error
Always pass previously allocated (if any) buffer, when calling `read_cb()` on error.
This commit is contained in:
parent
a057466c72
commit
b597d15779
@ -1127,7 +1127,7 @@ static void uv__read(uv_stream_t* stream) {
|
||||
if (is_ipc) {
|
||||
err = uv__stream_recv_cmsg(stream, &msg);
|
||||
if (err != 0) {
|
||||
stream->read_cb(stream, err, NULL);
|
||||
stream->read_cb(stream, err, &buf);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1347,7 +1347,7 @@ static void uv_pipe_read_eof(uv_loop_t* loop, uv_pipe_t* handle,
|
||||
handle->flags &= ~UV_HANDLE_READABLE;
|
||||
uv_read_stop((uv_stream_t*) handle);
|
||||
|
||||
handle->read_cb((uv_stream_t*) handle, UV_EOF, &uv_null_buf_);
|
||||
handle->read_cb((uv_stream_t*) handle, UV_EOF, &buf);
|
||||
}
|
||||
|
||||
|
||||
@ -1505,7 +1505,7 @@ void uv_process_pipe_read_req(uv_loop_t* loop, uv_pipe_t* handle,
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
uv_pipe_read_error_or_eof(loop, handle, GetLastError(), uv_null_buf_);
|
||||
uv_pipe_read_error_or_eof(loop, handle, GetLastError(), buf);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user