Commit b16b50d7 authored by Thomas Guillem's avatar Thomas Guillem

playback_service: fix register callbacks

parent 7fb32707
......@@ -116,20 +116,18 @@ media_list_destroy(media_list *p_ml)
media_list_cbs_id *
media_list_register_callbacks(media_list *p_ml, media_list_callbacks *p_cbs)
{
Eina_List *p_el;
media_list_callbacks *p_cbs_dup = malloc(sizeof(media_list_callbacks));
if (!p_cbs_dup)
return NULL;
memcpy(p_cbs_dup, p_cbs, sizeof(media_list_callbacks));
p_el = eina_list_append(p_ml->p_cbs_list, p_cbs_dup);
if (p_el == p_ml->p_cbs_list)
p_ml->p_cbs_list = eina_list_append(p_ml->p_cbs_list, p_cbs_dup);
if (!p_ml->p_cbs_list)
{
free(p_cbs_dup);
return NULL;
}
p_ml->p_cbs_list = p_el;
return (media_list_cbs_id *) p_cbs_dup;
}
......
......@@ -430,20 +430,21 @@ playback_service_set_context(playback_service *p_ps, enum PLAYLIST_CONTEXT i_ctx
playback_service_cbs_id *
playback_service_register_callbacks(playback_service *p_ps, playback_service_callbacks *p_cbs)
{
Eina_List *p_el;
playback_service_callbacks *p_cbs_dup = malloc(sizeof(playback_service_callbacks));
if (!p_cbs_dup)
{
LOGE("malloc failed");
return NULL;
}
memcpy(p_cbs_dup, p_cbs, sizeof(playback_service_callbacks));
p_el = eina_list_append(p_ps->p_cbs_list, p_cbs_dup);
if (p_el == p_ps->p_cbs_list)
p_ps->p_cbs_list = eina_list_append(p_ps->p_cbs_list, p_cbs_dup);
if (!p_ps->p_cbs_list)
{
free(p_cbs_dup);
return NULL;
}
p_ps->p_cbs_list = p_el;
return (playback_service_cbs_id *) p_cbs_dup;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment