summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/foundation/ABuffer.cpp
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/libstagefright/foundation/ABuffer.cpp
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/libstagefright/foundation/ABuffer.cpp')
-rw-r--r--media/libstagefright/foundation/ABuffer.cpp10
1 files changed, 3 insertions, 7 deletions
diff --git a/media/libstagefright/foundation/ABuffer.cpp b/media/libstagefright/foundation/ABuffer.cpp
index a5b81a8..3ebbbd9 100644
--- a/media/libstagefright/foundation/ABuffer.cpp
+++ b/media/libstagefright/foundation/ABuffer.cpp
@@ -29,13 +29,9 @@ ABuffer::ABuffer(size_t capacity)
mInt32Data(0),
mOwnsData(true) {
mData = malloc(capacity);
- if (mData == NULL) {
- mCapacity = 0;
- mRangeLength = 0;
- } else {
- mCapacity = capacity;
- mRangeLength = capacity;
- }
+ CHECK(mData != NULL);
+ mCapacity = capacity;
+ mRangeLength = capacity;
}
ABuffer::ABuffer(void *data, size_t capacity)