Skip to content

Commit

Permalink
fix a use-after-delete issue
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Apr 9, 2016
1 parent 0151d5c commit 5f7cbb8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions include/simulator/simulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1326,6 +1326,14 @@ namespace sim
, seq_nr{0}
{}

// this is move-only
#if LIBSIMULATOR_USE_MOVE
packet(packet const&) = delete;
packet& operator=(packet const&) = delete;
packet(packet&&) = default;
packet& operator=(packet&&) = default;
#endif

// to keep things simple, don't drop ACKs or errors
bool ok_to_drop() const
{
Expand Down
2 changes: 1 addition & 1 deletion src/tcp_socket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,9 +499,9 @@ namespace ip {
// read, deliver the error
if (total_received > 0) break;

m_incoming_queue.erase(m_incoming_queue.begin());
assert(p.ec);
ec = p.ec;
m_incoming_queue.erase(m_incoming_queue.begin());
m_channel.reset();
return 0;
}
Expand Down

0 comments on commit 5f7cbb8

Please sign in to comment.