diff options
author | Wei Jia <wjia@google.com> | 2015-07-20 11:34:22 -0700 |
---|---|---|
committer | Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de> | 2015-10-19 02:36:17 +0200 |
commit | 028af4dfa4fc39522d14c4a97f2b9096f8de1379 (patch) | |
tree | 60df70f6b933b8df859481ca67b87ac5f77b9b91 /media | |
parent | b1ef041e2de511818fb382004ce856dcacdf01c5 (diff) | |
download | frameworks_av-028af4dfa4fc39522d14c4a97f2b9096f8de1379.zip frameworks_av-028af4dfa4fc39522d14c4a97f2b9096f8de1379.tar.gz frameworks_av-028af4dfa4fc39522d14c4a97f2b9096f8de1379.tar.bz2 |
ABuffer: reset members when memory allocation fails.
Bug: 22077698
Change-Id: I2beb724662d041ad2339d0f4c7f983e7ac5e5e6f
(cherry picked from commit 94b0badc025b14141ff234e3e4e2745411742bac)
Tested-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/foundation/ABuffer.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/media/libstagefright/foundation/ABuffer.cpp b/media/libstagefright/foundation/ABuffer.cpp index 6173db4..5f5c977 100644 --- a/media/libstagefright/foundation/ABuffer.cpp +++ b/media/libstagefright/foundation/ABuffer.cpp @@ -23,12 +23,17 @@ namespace android { ABuffer::ABuffer(size_t capacity) - : mData(malloc(capacity)), - mCapacity(capacity), - mRangeOffset(0), - mRangeLength(capacity), + : mRangeOffset(0), 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) |