Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
pistache
Commits
a7ed13fa
Unverified
Commit
a7ed13fa
authored
Nov 03, 2018
by
Dennis Jenkins
Committed by
GitHub
Nov 03, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #344 from knowledge4igor/fix_two_heap_usage_after_free
Fix two heap usage after free
parents
da66820d
1f3d6c92
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
6 deletions
+5
-6
src/common/transport.cc
src/common/transport.cc
+5
-6
No files found.
src/common/transport.cc
View file @
a7ed13fa
...
...
@@ -187,7 +187,8 @@ Transport::asyncWriteImpl(Fd fd)
// cleanup will have been handled by handlePeerDisconnection
if
(
it
==
std
::
end
(
toWrite
))
{
return
;
}
auto
&
wq
=
it
->
second
;
while
(
wq
.
size
()
>
0
)
{
bool
stop
=
false
;
while
(
!
stop
&&
wq
.
size
()
>
0
)
{
auto
&
entry
=
wq
.
front
();
int
flags
=
entry
.
flags
;
const
BufferHolder
&
buffer
=
entry
.
buffer
;
...
...
@@ -202,10 +203,10 @@ Transport::asyncWriteImpl(Fd fd)
if
(
wq
.
size
()
==
0
)
{
toWrite
.
erase
(
fd
);
reactor
()
->
modifyFd
(
key
(),
fd
,
NotifyOn
::
Read
,
Polling
::
Mode
::
Edge
);
stop
=
true
;
}
};
bool
halt
=
false
;
size_t
totalWritten
=
buffer
.
offset
();
for
(;;)
{
ssize_t
bytesWritten
=
0
;
...
...
@@ -228,21 +229,20 @@ Transport::asyncWriteImpl(Fd fd)
else
{
cleanUp
();
deferred
.
reject
(
Pistache
::
Error
::
system
(
"Could not write data"
));
halt
=
true
;
}
break
;
}
else
{
totalWritten
+=
bytesWritten
;
if
(
totalWritten
>=
buffer
.
size
())
{
cleanUp
();
if
(
buffer
.
isFile
())
{
// done with the file buffer, nothing else knows whether to
// close it with the way the code is written.
::
close
(
buffer
.
fd
());
}
cleanUp
();
// Cast to match the type of defered template
// to avoid a BadType exception
deferred
.
resolve
(
static_cast
<
ssize_t
>
(
totalWritten
));
...
...
@@ -250,7 +250,6 @@ Transport::asyncWriteImpl(Fd fd)
}
}
}
if
(
halt
)
break
;
}
}
...
...
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