summaryrefslogtreecommitdiffstats
path: root/media/libeffects
diff options
context:
space:
mode:
authorSathishKumar Mani <smani@codeaurora.org>2015-09-25 18:17:46 -0700
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:25:11 -0600
commit4d0485d7daead3a28cac12c2e2cea25c2ade654d (patch)
treef491ca8ce40faf88c01b2a043ea70f652c095ebb /media/libeffects
parent197cd79c6314ac2e14ce94624e21f3c4e38dca7c (diff)
downloadframeworks_av-4d0485d7daead3a28cac12c2e2cea25c2ade654d.zip
frameworks_av-4d0485d7daead3a28cac12c2e2cea25c2ade654d.tar.gz
frameworks_av-4d0485d7daead3a28cac12c2e2cea25c2ade654d.tar.bz2
Stagefright: Add Checks for allocations
Warn allocation failures explicitly rather than crash trying to access unallocated memory Change-Id: Ie86c3ac130917e1f4030eb8207ac8350cba7711d
Diffstat (limited to 'media/libeffects')
-rw-r--r--media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index ad7ca4a..e01c414 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -29,6 +29,7 @@
#include "EffectBundle.h"
#include "math.h"
+#include <media/stagefright/foundation/ADebug.h>
// effect_handle_t interface implementation for bass boost
extern "C" const struct effect_interface_s gLvmEffectInterface;
@@ -563,6 +564,7 @@ int LvmBundle_init(EffectContext *pContext){
for (int i=0; i<LVM_NR_MEMORY_REGIONS; i++){
if (MemTab.Region[i].Size != 0){
MemTab.Region[i].pBaseAddress = malloc(MemTab.Region[i].Size);
+ CHECK(MemTab.Region[i].pBaseAddress != NULL);
if (MemTab.Region[i].pBaseAddress == LVM_NULL){
ALOGV("\tLVM_ERROR :LvmBundle_init CreateInstance Failed to allocate %" PRIu32
@@ -729,6 +731,7 @@ int LvmBundle_process(LVM_INT16 *pIn,
}
pContext->pBundledContext->workBuffer =
(LVM_INT16 *)malloc(frameCount * sizeof(LVM_INT16) * 2);
+ CHECK(pContext->pBundledContext->workBuffer != NULL);
pContext->pBundledContext->frameCount = frameCount;
}
pOutTmp = pContext->pBundledContext->workBuffer;