Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
B
brpc
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
brpc
Commits
9ec71f1d
Commit
9ec71f1d
authored
Jun 04, 2018
by
zhujiashun
Committed by
gejun
Sep 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix memory leak in h2
parent
b4f25c89
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
http2_rpc_protocol.cpp
src/brpc/policy/http2_rpc_protocol.cpp
+8
-3
No files found.
src/brpc/policy/http2_rpc_protocol.cpp
View file @
9ec71f1d
...
...
@@ -308,7 +308,7 @@ H2Context::H2Context(Socket* socket, const Server* server)
}
#if defined(UNIT_TEST)
// In ut, we hope _last_client_stream_id run out quickly to test the correctness
// of creating new h2 socket
// of creating new h2 socket
. This value is 100,000 less than 0x7FFFFFFF.
_last_client_stream_id
=
0x7FFE795F
;
#endif
}
...
...
@@ -334,8 +334,10 @@ H2StreamContext::H2StreamContext()
}
H2StreamContext
::~
H2StreamContext
()
{
int64_t
diff
=
_conn_ctx
->
local_settings
().
initial_window_size
-
_local_window_size
;
_conn_ctx
->
ReclaimWindowSize
(
diff
);
if
(
_conn_ctx
)
{
int64_t
diff
=
_conn_ctx
->
local_settings
().
initial_window_size
-
_local_window_size
;
_conn_ctx
->
ReclaimWindowSize
(
diff
);
}
}
int
H2Context
::
Init
()
{
...
...
@@ -581,6 +583,7 @@ H2ParseResult H2Context::OnHeaders(
_last_server_stream_id
=
frame_head
.
stream_id
;
sctx
=
new
H2StreamContext
(
this
,
frame_head
.
stream_id
);
if
(
!
TryToInsertStream
(
frame_head
.
stream_id
,
sctx
))
{
delete
sctx
;
LOG
(
ERROR
)
<<
"Fail to insert stream_id="
<<
frame_head
.
stream_id
;
return
MakeH2Error
(
H2_PROTOCOL_ERROR
);
}
...
...
@@ -997,6 +1000,7 @@ ParseResult ParseH2Message(butil::IOBuf *source, Socket *socket,
const
Server
*
server
=
static_cast
<
const
Server
*>
(
arg
);
ctx
=
new
H2Context
(
socket
,
server
);
if
(
ctx
->
Init
()
!=
0
)
{
delete
ctx
;
LOG
(
ERROR
)
<<
"Fail to init H2Context"
;
return
MakeParseError
(
PARSE_ERROR_NO_RESOURCE
);
}
...
...
@@ -1357,6 +1361,7 @@ H2UnsentRequest::AppendAndDestroySelf(butil::IOBuf* out, Socket* socket) {
CHECK
(
socket
->
CreatedByConnect
());
ctx
=
new
H2Context
(
socket
,
NULL
);
if
(
ctx
->
Init
()
!=
0
)
{
delete
ctx
;
socket
->
SetFailed
(
EFAILEDSOCKET
,
"Fail to init H2Context"
);
return
butil
::
Status
(
EFAILEDSOCKET
,
"Fail to init H2Context"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment