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

Commit 866645d5 authored by Greg Kaiser's avatar Greg Kaiser
Browse files

audioeffect: Avoid potential NULL dereference

We move our NULL check to be prior to a LOGV statement that
dereferences 'callbackInfo' (which aliases 'user').

Test: Treehugger
Change-Id: Icc4717f4f6acd16d263b2283a2f1434718f05ed8
parent e6402303
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -110,16 +110,16 @@ static void effectCallback(int event, void* user, void *info) {
    effect_callback_cookie *callbackInfo = (effect_callback_cookie *)user;
    effect_callback_cookie *callbackInfo = (effect_callback_cookie *)user;
    JNIEnv *env = AndroidRuntime::getJNIEnv();
    JNIEnv *env = AndroidRuntime::getJNIEnv();


    ALOGV("effectCallback: callbackInfo %p, audioEffect_ref %p audioEffect_class %p",
            callbackInfo,
            callbackInfo->audioEffect_ref,
            callbackInfo->audioEffect_class);

    if (!user || !env) {
    if (!user || !env) {
        ALOGW("effectCallback error user %p, env %p", user, env);
        ALOGW("effectCallback error user %p, env %p", user, env);
        return;
        return;
    }
    }


    ALOGV("effectCallback: callbackInfo %p, audioEffect_ref %p audioEffect_class %p",
            callbackInfo,
            callbackInfo->audioEffect_ref,
            callbackInfo->audioEffect_class);

    switch (event) {
    switch (event) {
    case AudioEffect::EVENT_CONTROL_STATUS_CHANGED:
    case AudioEffect::EVENT_CONTROL_STATUS_CHANGED:
        if (info == 0) {
        if (info == 0) {