summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/include
diff options
context:
space:
mode:
authorWonsik Kim <wonsik@google.com>2015-09-08 17:32:28 +0900
committerWonsik Kim <wonsik@google.com>2015-09-09 13:58:29 +0900
commit316c3d929ffb004b0150d515e82aede02208ce97 (patch)
treecc281ba1a211e352d0e40e980c4d911d5a22f805 /media/libstagefright/include
parent35e03636d6fa0c7c33c67e10686657849a61aff8 (diff)
downloadframeworks_av-316c3d929ffb004b0150d515e82aede02208ce97.zip
frameworks_av-316c3d929ffb004b0150d515e82aede02208ce97.tar.gz
frameworks_av-316c3d929ffb004b0150d515e82aede02208ce97.tar.bz2
NuCachedSource2: fix possible erroneous early free
Because the constructor of NuCachedSource2 sent a message to AHandlerReflector object, AHandlerReflector::onMessageReceived could have executed just before the object gets wrapped in a strong pointer, resulting in erroneous early free. Fix the issue by using static Create function to ensure the message is sent after the object is wrapped in a sp. Bug: 23882800 Change-Id: I38a9d7a3083f184b4c81d0b00ba1661721278855
Diffstat (limited to 'media/libstagefright/include')
-rw-r--r--media/libstagefright/include/NuCachedSource2.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/media/libstagefright/include/NuCachedSource2.h b/media/libstagefright/include/NuCachedSource2.h
index 4252706..a29bdf9 100644
--- a/media/libstagefright/include/NuCachedSource2.h
+++ b/media/libstagefright/include/NuCachedSource2.h
@@ -28,7 +28,7 @@ struct ALooper;
struct PageCache;
struct NuCachedSource2 : public DataSource {
- NuCachedSource2(
+ static sp<NuCachedSource2> Create(
const sp<DataSource> &source,
const char *cacheConfig = NULL,
bool disconnectAtHighwatermark = false);
@@ -72,6 +72,11 @@ protected:
private:
friend struct AHandlerReflector<NuCachedSource2>;
+ NuCachedSource2(
+ const sp<DataSource> &source,
+ const char *cacheConfig,
+ bool disconnectAtHighwatermark);
+
enum {
kPageSize = 65536,
kDefaultHighWaterThreshold = 20 * 1024 * 1024,