Commit b46cf57d authored by Max Kellermann's avatar Max Kellermann

event/BufferedSocket: OnSocketReady() returns true after close

Fixes use-after-free bug (https://bugs.musicpd.org/view.php?id=4548).
parent 6f59d71e
......@@ -5,6 +5,7 @@ ver 0.19.17 (not yet released)
* fix spurious seek error "Failed to allocate silence buffer"
* replay gain: fix "replay_gain_handler mixer" setting
* DSD: use 0x69 as silence pattern
* fix use-after-free bug on "close"
ver 0.19.16 (2016/06/13)
* faster seeking
......
......@@ -118,9 +118,15 @@ BufferedSocket::OnSocketReady(unsigned flags)
if (flags & READ) {
assert(!input.IsFull());
if (!ReadToBuffer() || !ResumeInput())
if (!ReadToBuffer())
return false;
if (!ResumeInput())
/* we must return "true" here or
SocketMonitor::Dispatch() will call
Cancel() on a freed object */
return true;
if (!input.IsFull())
ScheduleRead();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment