forked from enlightenment/efl
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:
parent
bd0d03fbcf
commit
3b06d11fdf
|
@ -42,6 +42,7 @@ _client_msg_free(Client *client)
|
|||
{
|
||||
client->msg.reading = EINA_FALSE;
|
||||
free(client->msg.buf);
|
||||
client->msg.buf = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue