summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/foundation
diff options
context:
space:
mode:
authorWei Jia <wjia@google.com>2015-08-18 13:16:40 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-08-18 13:16:40 +0000
commit228c3de31bc7c8087b78169cc30974b5d99a47fa (patch)
treed29f1bb9a8cf8b3e310a69306bb258297812546c /media/libstagefright/foundation
parent051b8572c2751781925c0e58698dcbb52c8e268e (diff)
parentccc02053f07ea9c1d24678a2b191c5b6cef28094 (diff)
downloadframeworks_av-228c3de31bc7c8087b78169cc30974b5d99a47fa.zip
frameworks_av-228c3de31bc7c8087b78169cc30974b5d99a47fa.tar.gz
frameworks_av-228c3de31bc7c8087b78169cc30974b5d99a47fa.tar.bz2
am ccc02053: am ef2c6e04: am 45e493e4: Merge "Merge commit \'5a289b87\' into HEAD" into lmp-dev
* commit 'ccc02053f07ea9c1d24678a2b191c5b6cef28094': ABuffer: reset members when memory allocation fails.
Diffstat (limited to 'media/libstagefright/foundation')
-rw-r--r--media/libstagefright/foundation/ABuffer.cpp11
1 files changed, 8 insertions, 3 deletions
diff --git a/media/libstagefright/foundation/ABuffer.cpp b/media/libstagefright/foundation/ABuffer.cpp
index b214870..4913fd4 100644
--- a/media/libstagefright/foundation/ABuffer.cpp
+++ b/media/libstagefright/foundation/ABuffer.cpp
@@ -25,12 +25,17 @@ namespace android {
ABuffer::ABuffer(size_t capacity)
: mMediaBufferBase(NULL),
- mData(malloc(capacity)),
- mCapacity(capacity),
mRangeOffset(0),
- mRangeLength(capacity),
mInt32Data(0),
mOwnsData(true) {
+ mData = malloc(capacity);
+ if (mData == NULL) {
+ mCapacity = 0;
+ mRangeLength = 0;
+ } else {
+ mCapacity = capacity;
+ mRangeLength = capacity;
+ }
}
ABuffer::ABuffer(void *data, size_t capacity)