summaryrefslogtreecommitdiffstats
path: root/services/surfaceflinger
diff options
context:
space:
mode:
authorMathias Agopian <mathias@google.com>2012-09-25 15:28:44 -0700
committerMathias Agopian <mathias@google.com>2012-09-25 15:30:38 -0700
commit7b1905113712281c777b230648d3fbb69ae4f42c (patch)
treee465a16482c4db5b577e95771982c230d2c8623d /services/surfaceflinger
parentbb53b0e4b97634bc31808965f81b3ab4193d0e84 (diff)
downloadframeworks_native-7b1905113712281c777b230648d3fbb69ae4f42c.zip
frameworks_native-7b1905113712281c777b230648d3fbb69ae4f42c.tar.gz
frameworks_native-7b1905113712281c777b230648d3fbb69ae4f42c.tar.bz2
fix a crasher when running out of memory
MemoryHeapBase::getBase() returns MAP_FAILED in case or OOM, not null which is what SF was checking against. This addresses one of the issues of bug 7230543. Bug: 7230543 Change-Id: I763a88f64a2f9ff75eb139cfbaf9a1a9746c5577
Diffstat (limited to 'services/surfaceflinger')
-rw-r--r--services/surfaceflinger/SurfaceFlinger.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 6ed9843..ceae8d7 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2497,7 +2497,7 @@ status_t SurfaceFlinger::captureScreenImplLocked(const sp<IBinder>& display,
sp<MemoryHeapBase> base(
new MemoryHeapBase(size, 0, "screen-capture") );
void* const ptr = base->getBase();
- if (ptr) {
+ if (ptr != MAP_FAILED) {
// capture the screen with glReadPixels()
ScopedTrace _t(ATRACE_TAG, "glReadPixels");
glReadPixels(0, 0, sw, sh, GL_RGBA, GL_UNSIGNED_BYTE, ptr);