Free packet buffer outside of the dispatcher

This commit is contained in:
Daniel Zaoui 2017-03-15 22:44:02 +02:00
parent cd8b2fc66b
commit 6ad0d6ab22
1 changed files with 4 additions and 7 deletions

View File

@ -610,6 +610,9 @@ _monitor(void *_data)
// something we don't understand
e_debug("EINA DEBUG ERROR: Unknown command");
}
/* Free the buffer only if the default dispatcher is used */
if (_session->dispatch_cb == eina_debug_dispatch)
free(buffer);
}
else if (size == 0)
{
@ -725,12 +728,7 @@ eina_debug_dispatch(Eina_Debug_Session *session, void *buffer)
{
Eina_Debug_Packet_Header *hdr = buffer;
Eina_Debug_Error ret = EINA_DEBUG_OK;
if (hdr->thread_id == 0)
{
ret = _self_dispatch(session, buffer);
free(buffer);
return ret;
}
if (hdr->thread_id == 0) return _self_dispatch(session, buffer);
else
{
int i, nb_calls = 0;
@ -786,7 +784,6 @@ eina_debug_dispatch(Eina_Debug_Session *session, void *buffer)
}
eina_spinlock_release(&_eina_debug_thread_lock);
}
free(buffer);
}
return ret;
}