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
c4908ae7
Commit
c4908ae7
authored
Jan 25, 2019
by
zhujiashun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix a leak when sending h2 req
parent
ae0df7fe
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
11 deletions
+12
-11
http2_rpc_protocol.cpp
src/brpc/policy/http2_rpc_protocol.cpp
+12
-11
No files found.
src/brpc/policy/http2_rpc_protocol.cpp
View file @
c4908ae7
...
...
@@ -1522,18 +1522,9 @@ H2UnsentRequest::AppendAndDestroySelf(butil::IOBuf* out, Socket* socket) {
<<
" h2req="
<<
(
StreamUserData
*
)
this
;
return
butil
::
Status
(
EH2RUNOUTSTREAMS
,
"Fail to allocate stream_id"
);
}
H2StreamContext
*
sctx
=
_sctx
.
release
();
sctx
->
Init
(
ctx
,
id
);
const
int
rc
=
ctx
->
TryToInsertStream
(
id
,
sctx
);
if
(
rc
<
0
)
{
delete
sctx
;
return
butil
::
Status
(
EINTERNAL
,
"Fail to insert existing stream_id"
);
}
else
if
(
rc
>
0
)
{
delete
sctx
;
return
butil
::
Status
(
ELOGOFF
,
"the connection just issued GOAWAY"
);
}
_stream_id
=
sctx
->
stream_id
();
std
::
unique_ptr
<
H2StreamContext
>
sctx
(
std
::
move
(
_sctx
));
sctx
->
Init
(
ctx
,
id
);
// flow control
if
(
!
_cntl
->
request_attachment
().
empty
())
{
const
int64_t
data_size
=
_cntl
->
request_attachment
().
size
();
...
...
@@ -1542,6 +1533,16 @@ H2UnsentRequest::AppendAndDestroySelf(butil::IOBuf* out, Socket* socket) {
}
}
const
int
rc
=
ctx
->
TryToInsertStream
(
id
,
sctx
.
get
());
if
(
rc
<
0
)
{
return
butil
::
Status
(
EINTERNAL
,
"Fail to insert existing stream_id"
);
}
else
if
(
rc
>
0
)
{
return
butil
::
Status
(
ELOGOFF
,
"the connection just issued GOAWAY"
);
}
_stream_id
=
sctx
->
stream_id
();
// After calling TryToInsertStream, ownership of sctx is transferred to ctx
sctx
.
release
();
HPacker
&
hpacker
=
ctx
->
hpacker
();
butil
::
IOBufAppender
appender
;
HPackOptions
options
;
...
...
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