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

Commit 304eafce authored by Mikhail Naganov's avatar Mikhail Naganov
Browse files

Zero initialize audio_port_config and containing structs

Add zero initialization for struct audio_port_config and
the structures that contain it: audio_port and audio_patch.

Left intact places where the struct is overwritten completely
or memset'd right after declaration.

Test: make
Change-Id: I30c9eb8822f35a394dd49ea0891430b539d0e81e
parent 98be3b29
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -1294,11 +1294,8 @@ android_media_AudioSystem_createAudioPatch(JNIEnv *env, jobject clazz,
        handle = (audio_patch_handle_t)env->GetIntField(jPatchHandle, gAudioHandleFields.mId);
    }

    struct audio_patch nPatch;
    struct audio_patch nPatch = { .id = handle };

    nPatch.id = handle;
    nPatch.num_sources = 0;
    nPatch.num_sinks = 0;
    jobject jSource = NULL;
    jobject jSink = NULL;

@@ -1584,7 +1581,7 @@ android_media_AudioSystem_setAudioPortConfig(JNIEnv *env, jobject clazz,
    if (!env->IsInstanceOf(jAudioPortConfig, gAudioPortConfigClass)) {
        return AUDIO_JAVA_BAD_VALUE;
    }
    struct audio_port_config nAudioPortConfig;
    struct audio_port_config nAudioPortConfig = {};
    jint jStatus = convertAudioPortConfigToNative(env, &nAudioPortConfig, jAudioPortConfig, true);
    if (jStatus != AUDIO_JAVA_SUCCESS) {
        return jStatus;