Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 27a9bff3 authored by Andy Hung's avatar Andy Hung Committed by The Android Automerger
Browse files

DO NOT MERGE - volume_listener: fix release

use safe iteration of list when removing node.

Bug: 23731264
Change-Id: I6d0c51638b6a3de684cf595833dc4d0fc7e8c8b5
(cherry picked from commit 591ef60f)
parent 9fb88063
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -664,7 +664,7 @@ static int vol_prc_lib_create(const effect_uuid_t *uuid,

static int vol_prc_lib_release(effect_handle_t handle)
{
    struct listnode *node = NULL;
    struct listnode *node, *temp_node_next;
    vol_listener_context_t *context = NULL;
    vol_listener_context_t *recv_contex = (vol_listener_context_t *)handle;
    int status = -1;
@@ -674,7 +674,7 @@ static int vol_prc_lib_release(effect_handle_t handle)
    pthread_mutex_lock(&vol_listner_init_lock);

    // check if the handle/context provided is valid
    list_for_each(node, &vol_effect_list) {
    list_for_each_safe(node, temp_node_next, &vol_effect_list) {
        context = node_to_item(node, struct vol_listener_context_s, effect_list_node);
        if ((memcmp(&(context->desc->uuid), &(recv_contex->desc->uuid), sizeof(effect_uuid_t)) == 0)
            && (context->session_id == recv_contex->session_id)