summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-01-09 16:10:40 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-01-09 17:37:41 +0900
commit7d4209d0edc09dfa55cb40cc05b21983b241a65f (patch)
treed1b169ddba48ae39368c2ae34d1421c5a9f0612b
parente99ba012056553fd2eeacf5e6ddcf1e462a87795 (diff)
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 :)
-rw-r--r--src/bin/evas/evas_cserve2_messages.c1
-rw-r--r--src/bin/evas/evas_cserve2_requests.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/src/bin/evas/evas_cserve2_messages.c b/src/bin/evas/evas_cserve2_messages.c
index 168bd72d6c..8f4f64c371 100644
--- a/src/bin/evas/evas_cserve2_messages.c
+++ b/src/bin/evas/evas_cserve2_messages.c
@@ -42,6 +42,7 @@ _client_msg_free(Client *client)
42{ 42{
43 client->msg.reading = EINA_FALSE; 43 client->msg.reading = EINA_FALSE;
44 free(client->msg.buf); 44 free(client->msg.buf);
45 client->msg.buf = NULL;
45} 46}
46 47
47static void 48static void
diff --git a/src/bin/evas/evas_cserve2_requests.c b/src/bin/evas/evas_cserve2_requests.c
index 9a8eb2f4c0..e5754ae137 100644
--- a/src/bin/evas/evas_cserve2_requests.c
+++ b/src/bin/evas/evas_cserve2_requests.c
@@ -432,11 +432,13 @@ _slave_dead_cb(Slave *s EINA_UNUSED, void *data)
432 Slave_Worker *sw = data; 432 Slave_Worker *sw = data;
433 Slave_Request *req = sw->data; 433 Slave_Request *req = sw->data;
434 Eina_List **working = &_workers[sw->type].working; 434 Eina_List **working = &_workers[sw->type].working;
435 Eina_List **idle = &_workers[sw->type].idle;
435 436
436 if (req) 437 if (req)
437 _cserve2_request_failed(req, CSERVE2_LOADER_DIED); 438 _cserve2_request_failed(req, CSERVE2_LOADER_DIED);
438 439
439 *working = eina_list_remove(*working, sw); 440 *working = eina_list_remove(*working, sw);
441 *idle = eina_list_remove(*idle, sw);
440 free(sw); 442 free(sw);
441} 443}
442 444