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
b28cde8b
Commit
b28cde8b
authored
Nov 03, 2018
by
knowledge4igor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix two cases when heap usage takes place after free
parent
2f5f5193
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 @
b28cde8b
...
...
@@ -191,7 +191,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
;
...
...
@@ -207,9 +208,9 @@ Transport::asyncWriteImpl(Fd fd)
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
;
...
...
@@ -232,21 +233,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
));
...
...
@@ -254,7 +254,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