fix null dereference on aeli
EffectProxyCreate does not return fail and assign the pointers in
the aeli when the two effects don't have the flag
EFFECT_FLAG_HW_ACC_TUNNEL. It causes problem when Effect_command
does dereference on those two pointers.
Bug: 182867964
Test: mm libeffectproxy
Test: create effects without EFFECT_FLAG_HW_ACC_TUNNEL
Change-Id: I37502e86ac5d491e7d792251197338905849e25c
diff --git a/media/libeffects/proxy/EffectProxy.cpp b/media/libeffects/proxy/EffectProxy.cpp
index c010d68..be9f8c0 100644
--- a/media/libeffects/proxy/EffectProxy.cpp
+++ b/media/libeffects/proxy/EffectProxy.cpp
@@ -116,6 +116,16 @@
pContext->sube[SUB_FX_OFFLOAD] = sube[1];
pContext->desc[SUB_FX_OFFLOAD] = desc[1];
pContext->aeli[SUB_FX_OFFLOAD] = aeli[1];
+ } else {
+ ALOGE("Both effects have (or don't have) EFFECT_FLAG_HW_ACC_TUNNEL flag");
+ delete[] sube;
+ delete[] desc;
+ delete[] aeli;
+ delete[] pContext->sube;
+ delete[] pContext->desc;
+ delete[] pContext->aeli;
+ delete pContext;
+ return -EINVAL;
}
delete[] desc;
delete[] aeli;