summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzachr <zachr@chromium.org>2015-02-18 11:23:35 -0800
committerCommit bot <commit-bot@chromium.org>2015-02-18 19:23:59 +0000
commit17beef666072b2a022752e67a8b23e616a76d038 (patch)
tree01dc96c4894ef2f9440ef6b843c6adfe832e803a
parent777a126ec7c9fbd50c4f62b27de648e5b306fc7d (diff)
downloadchromium_src-17beef666072b2a022752e67a8b23e616a76d038.zip
chromium_src-17beef666072b2a022752e67a8b23e616a76d038.tar.gz
chromium_src-17beef666072b2a022752e67a8b23e616a76d038.tar.bz2
content: check scanout buffer allocation before use
Sometimes buffer allocation fails and returns a null pointer. This caused a crash in buffer_queue that this patch prevents. TEST=chromium OS on freon VMs BUG=None R=danakj@chromium.org,alexst@chromium.org Review URL: https://codereview.chromium.org/935793003 Cr-Commit-Position: refs/heads/master@{#316873}
-rw-r--r--content/browser/compositor/buffer_queue.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/content/browser/compositor/buffer_queue.cc b/content/browser/compositor/buffer_queue.cc
index c215827..e094972 100644
--- a/content/browser/compositor/buffer_queue.cc
+++ b/content/browser/compositor/buffer_queue.cc
@@ -173,6 +173,11 @@ BufferQueue::AllocatedSurface BufferQueue::GetNextSurface() {
size_, gpu::ImageFactory::ImageFormatToGpuMemoryBufferFormat(
internalformat_),
surface_id_));
+ if (!buffer) {
+ gl->DeleteTextures(1, &texture);
+ DLOG(ERROR) << "Failed to allocate GPU memory buffer";
+ return AllocatedSurface();
+ }
unsigned int id = gl->CreateImageCHROMIUM(
buffer->AsClientBuffer(), size_.width(), size_.height(), internalformat_);