fix: memory leak and crash when id is NULL in iq_id_handler_add (upstream 0218ba26)
This commit is contained in:
@@ -358,6 +358,13 @@ _iq_id_handler_free(ProfIqHandler* handler)
|
||||
void
|
||||
iq_id_handler_add(const char* const id, ProfIqCallback func, ProfIqFreeCallback free_func, void* userdata)
|
||||
{
|
||||
if (id == NULL) {
|
||||
if (free_func) {
|
||||
free_func(userdata);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
ProfIqHandler* handler = malloc(sizeof(ProfIqHandler));
|
||||
if (handler) {
|
||||
handler->func = func;
|
||||
|
||||
Reference in New Issue
Block a user