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

Commit bfe193d4 authored by Karthik Reddy Katta's avatar Karthik Reddy Katta
Browse files

hal: Fix memory leak in audio HAL

Fix memory leak while converting the key value pairs to
string. Free the string array after printing it.

CRs-fixed: 722256
Change-Id: I7e081ea1cd38bf28cd0b53b2c479e6644b189903
parent 805c8ed9
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1786,8 +1786,11 @@ int platform_set_parameters(void *platform, struct str_parms *parms)
    char value[256] = {0};
    int val;
    int ret = 0, err;
    char *kv_pairs = NULL;

    ALOGV("%s: enter: %s", __func__, str_parms_to_str(parms));
    kv_pairs = str_parms_to_str(parms);
    ALOGV("%s: enter: - %s", __func__, kv_pairs);
    free(kv_pairs);

    err = str_parms_get_str(parms, AUDIO_PARAMETER_KEY_SLOWTALK, value, sizeof(value));
    if (err >= 0) {
@@ -1932,6 +1935,7 @@ void platform_get_parameters(void *platform,
    char *str = NULL;
    char value[256] = {0};
    int ret;
    char *kv_pairs = NULL;

    ret = str_parms_get_str(query, AUDIO_PARAMETER_KEY_SLOWTALK,
                            value, sizeof(value));
@@ -1952,7 +1956,9 @@ void platform_get_parameters(void *platform,
        str_parms_add_str(reply, AUDIO_PARAMETER_KEY_VOLUME_BOOST, value);
    }

    ALOGV("%s: exit: returns - %s", __func__, str_parms_to_str(reply));
    kv_pairs = str_parms_to_str(reply);
    ALOGV("%s: exit: returns - %s", __func__, kv_pairs);
    free(kv_pairs);
}

/* Delay in Us */