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

Commit 2e9b2e4d authored by Aalique Grahame's avatar Aalique Grahame Committed by Gerrit - the friendly Code Review server
Browse files

hal: update active_input after usecase is removed from list

update active_input only after the usecase that is being
stopped is removed from the usecase list. Otherwise,
active_input can be set to the same usecase that is being
terminated and input stream deallocated. At that point
members of active_input will be invalid.

CRs-Fixed: 1094825
Change-Id: I200ed352ff3c9d048884c9e464ba7d75fc7beeca
parent 6379b8d8
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -1666,8 +1666,6 @@ static int stop_input_stream(struct stream_in *in)
    struct audio_usecase *uc_info;
    struct audio_device *adev = in->dev;

    adev->active_input = get_next_active_input(adev);

    ALOGV("%s: enter: usecase(%d: %s)", __func__,
          in->usecase, use_case_table[in->usecase]);
    uc_info = get_usecase_from_list(adev, in->usecase);
@@ -1689,6 +1687,8 @@ static int stop_input_stream(struct stream_in *in)
    list_remove(&uc_info->list);
    free(uc_info);

    adev->active_input = get_next_active_input(adev);

    ALOGV("%s: exit: status(%d)", __func__, ret);
    return ret;
}