forked from enlightenment/efl
Evas/cserve2: Fix crash during shutdown
If an image failed to load, and cserve2 returned an error message, then the File_Entry was freed, but not removed from the hash. Solution: remove entry from the hash, let the callback free the data.
This commit is contained in:
parent
ce166ec223
commit
b10dcb5c23
|
@ -690,8 +690,9 @@ _image_opened_cb(void *data, const void *msg_received, int size)
|
||||||
}
|
}
|
||||||
ie->open_rid = 0;
|
ie->open_rid = 0;
|
||||||
|
|
||||||
if (answer->type != CSERVE2_OPENED)
|
if ((answer->type != CSERVE2_OPENED) || (size < (int) sizeof(*msg)))
|
||||||
{
|
{
|
||||||
|
File_Entry *fentry = ie->data1;
|
||||||
if (answer->type == CSERVE2_ERROR)
|
if (answer->type == CSERVE2_ERROR)
|
||||||
{
|
{
|
||||||
const Msg_Error *msg_error = msg_received;
|
const Msg_Error *msg_error = msg_received;
|
||||||
|
@ -700,15 +701,9 @@ _image_opened_cb(void *data, const void *msg_received, int size)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ERR("Invalid message type received: %d (%s)", answer->type, __FUNCTION__);
|
ERR("Invalid message type received: %d (%s)", answer->type, __FUNCTION__);
|
||||||
free(ie->data1);
|
fentry = ie->data1;
|
||||||
ie->data1 = NULL;
|
EINA_REFCOUNT_UNREF(fentry)
|
||||||
return EINA_TRUE;
|
eina_hash_del(_file_entries, fentry->hkey, fentry);
|
||||||
}
|
|
||||||
else if (size < (int) sizeof(*msg))
|
|
||||||
{
|
|
||||||
ERR("Received message is too small");
|
|
||||||
free(ie->data1);
|
|
||||||
ie->data1 = NULL;
|
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue