Evas cserve2: Fix crash in cserve2 when slaves die

If a slave dies (eg. killed) when it's idle, then cserve2 will crash
miserably at the next request. Indeed, the dead slave's corpse was
removed from the working slaves' list but not from the lazy idle
slaves list.

Also, set read buffer to NULL after free. Just in case. We never know :)
This commit is contained in:
Jean-Philippe Andre 2014-01-09 16:10:40 +09:00
parent bd0d03fbcf
commit 3b06d11fdf
2 changed files with 3 additions and 0 deletions

View File

@ -42,6 +42,7 @@ _client_msg_free(Client *client)
{
client->msg.reading = EINA_FALSE;
free(client->msg.buf);
client->msg.buf = NULL;
}
static void

View File

@ -432,11 +432,13 @@ _slave_dead_cb(Slave *s EINA_UNUSED, void *data)
Slave_Worker *sw = data;
Slave_Request *req = sw->data;
Eina_List **working = &_workers[sw->type].working;
Eina_List **idle = &_workers[sw->type].idle;
if (req)
_cserve2_request_failed(req, CSERVE2_LOADER_DIED);
*working = eina_list_remove(*working, sw);
*idle = eina_list_remove(*idle, sw);
free(sw);
}