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

Commit 5c86ca4a authored by Chih-hung Hsieh's avatar Chih-hung Hsieh Committed by android-build-merger
Browse files

Merge "Fix potential memory leak."

am: 89bdf3ae

Change-Id: If83e8a7631f7cbb37b0f1724b94957a9dab347ca
parents 9cee5d15 89bdf3ae
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -460,12 +460,13 @@ size_t AudioPolicyEffects::readParamValue(cnode *node,
        len = strnlen(node->value, EFFECT_STRING_LEN_MAX);
        if (*curSize + len + 1 > *totSize) {
            *totSize = *curSize + len + 1;
            *param = (char *)realloc(*param, *totSize);
            if (*param == NULL) {
            char *newParam = (char *)realloc(*param, *totSize);
            if (newParam == NULL) {
                len = 0;
                ALOGE("%s realloc error for string len %zu", __func__, *totSize);
                goto exit;
            }
            *param = newParam;
        }
        strncpy(*param + *curSize, node->value, len);
        *curSize += len;