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

Commit 4255a633 authored by Revathi Uddaraju's avatar Revathi Uddaraju Committed by Revathi Uddaraju
Browse files

hal: memleak issue in audio service.

Devices are assigned to listnode but not cleared which is
leading to memleak.
To make sure memory leak does not happen, devices are cleared
in the listnode once done with it.

Change-Id: I023937dce0cee9735227a5ad2c93526799299962
parent 0ec934a6
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -5179,6 +5179,7 @@ int route_output_stream(struct stream_out *out,
    /*handles device and call state changes*/
    audio_extn_extspk_update(adev->extspk);

    clear_devices(&new_devices);
error:
    ALOGV("%s: exit: code(%d)", __func__, ret);
    return ret;
@@ -10279,10 +10280,12 @@ int adev_create_audio_patch(struct audio_hw_device *dev,

    // Update routing for stream
    if (stream != NULL) {
        if (p_info->patch_type == PATCH_PLAYBACK)
        if (p_info->patch_type == PATCH_PLAYBACK) {
            ret = route_output_stream((struct stream_out *) stream, &devices);
        else if (p_info->patch_type == PATCH_CAPTURE)
            clear_devices(&devices);
        } else if (p_info->patch_type == PATCH_CAPTURE) {
            ret = route_input_stream((struct stream_in *) stream, &devices, input_source);
        }
        if (ret < 0) {
            pthread_mutex_lock(&adev->lock);
            s_info->patch_handle = AUDIO_PATCH_HANDLE_NONE;