diff options
author | Chong Zhang <chz@google.com> | 2015-05-07 12:07:31 -0700 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2015-05-07 12:08:20 -0700 |
commit | 37d8b27e5470d8243288a87e90871efd43f29606 (patch) | |
tree | 9a653e7901c7f91cdaf06bf71269f873ffc2797f | |
parent | 32fa6d0e65dbf956e253a1006e9419dce2fe75c9 (diff) | |
download | frameworks_av-37d8b27e5470d8243288a87e90871efd43f29606.zip frameworks_av-37d8b27e5470d8243288a87e90871efd43f29606.tar.gz frameworks_av-37d8b27e5470d8243288a87e90871efd43f29606.tar.bz2 |
MediaHTTP: add more null ptr and init checks
bug: 20912192
Change-Id: I83cf59ff85fd8aa3a19a696ceb97cd8aa922b8ba
-rw-r--r-- | media/libmedia/IMediaHTTPService.cpp | 1 | ||||
-rw-r--r-- | media/libstagefright/http/MediaHTTP.cpp | 7 |
2 files changed, 6 insertions, 2 deletions
diff --git a/media/libmedia/IMediaHTTPService.cpp b/media/libmedia/IMediaHTTPService.cpp index f30d0f3..0c16a2b 100644 --- a/media/libmedia/IMediaHTTPService.cpp +++ b/media/libmedia/IMediaHTTPService.cpp @@ -44,6 +44,7 @@ struct BpMediaHTTPService : public BpInterface<IMediaHTTPService> { status_t err = reply.readInt32(); if (err != OK) { + ALOGE("Unable to make HTTP connection (err = %d)", err); return NULL; } diff --git a/media/libstagefright/http/MediaHTTP.cpp b/media/libstagefright/http/MediaHTTP.cpp index bb89567..2d9b3d4 100644 --- a/media/libstagefright/http/MediaHTTP.cpp +++ b/media/libstagefright/http/MediaHTTP.cpp @@ -30,12 +30,11 @@ namespace android { MediaHTTP::MediaHTTP(const sp<IMediaHTTPConnection> &conn) - : mInitCheck(NO_INIT), + : mInitCheck((conn != NULL) ? OK : NO_INIT), mHTTPConnection(conn), mCachedSizeValid(false), mCachedSize(0ll), mDrmManagerClient(NULL) { - mInitCheck = OK; } MediaHTTP::~MediaHTTP() { @@ -171,6 +170,10 @@ void MediaHTTP::getDrmInfo( } String8 MediaHTTP::getUri() { + if (mInitCheck != OK) { + return String8::empty(); + } + String8 uri; if (OK == mHTTPConnection->getUri(&uri)) { return uri; |