summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-14 22:07:27 +0000
committermattm@chromium.org <mattm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-07-14 22:07:27 +0000
commitc7aff9a658728effaceb6d88764003f7c2c95cdf (patch)
tree192775187f3baf02c790ba99ee2dfb205366a031
parent0b7619baadf4324f6685a136433ac2aa2f34c8bd (diff)
downloadchromium_src-c7aff9a658728effaceb6d88764003f7c2c95cdf.zip
chromium_src-c7aff9a658728effaceb6d88764003f7c2c95cdf.tar.gz
chromium_src-c7aff9a658728effaceb6d88764003f7c2c95cdf.tar.bz2
Coverity: Fix leaking TransportDIB in GpuBackingStore{GLX,Win}::OnPaintToBackingStore
CID=8190,9146 TEST=none BUG=none Review URL: http://codereview.chromium.org/2997002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52410 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--app/surface/transport_dib.h3
-rw-r--r--chrome/gpu/gpu_backing_store_glx.cc2
-rw-r--r--chrome/gpu/gpu_backing_store_win.cc4
3 files changed, 5 insertions, 4 deletions
diff --git a/app/surface/transport_dib.h b/app/surface/transport_dib.h
index ffa10e4..c392c5f 100644
--- a/app/surface/transport_dib.h
+++ b/app/surface/transport_dib.h
@@ -122,7 +122,8 @@ class TransportDIB {
// renderer.
static TransportDIB* Create(size_t size, uint32 sequence_num);
- // Map the referenced transport DIB. Returns NULL on failure.
+ // Map the referenced transport DIB. The caller owns the returned object.
+ // Returns NULL on failure.
static TransportDIB* Map(Handle transport_dib);
// Returns true if the handle is valid.
diff --git a/chrome/gpu/gpu_backing_store_glx.cc b/chrome/gpu/gpu_backing_store_glx.cc
index 1c91a641..37076cc 100644
--- a/chrome/gpu/gpu_backing_store_glx.cc
+++ b/chrome/gpu/gpu_backing_store_glx.cc
@@ -63,7 +63,7 @@ void GpuBackingStoreGLX::OnPaintToBackingStore(
TransportDIB::Id id,
const gfx::Rect& bitmap_rect,
const std::vector<gfx::Rect>& copy_rects) {
- TransportDIB* dib = TransportDIB::Map(id);
+ scoped_ptr<TransportDIB> dib(TransportDIB::Map(id));
view_->BindContext();
scoped_ptr<skia::PlatformCanvas> canvas(
diff --git a/chrome/gpu/gpu_backing_store_win.cc b/chrome/gpu/gpu_backing_store_win.cc
index a38e8b9..d5af441 100644
--- a/chrome/gpu/gpu_backing_store_win.cc
+++ b/chrome/gpu/gpu_backing_store_win.cc
@@ -130,8 +130,8 @@ void GpuBackingStoreWin::OnPaintToBackingStore(
HANDLE section = win_util::GetSectionFromProcess(
id.handle, source_process_handle, false /* read write */);
CHECK(section);
- TransportDIB* dib = TransportDIB::Map(section);
- CHECK(dib);
+ scoped_ptr<TransportDIB> dib(TransportDIB::Map(section));
+ CHECK(dib.get());
if (!backing_store_dib_) {
backing_store_dib_ = CreateDIB(hdc_, size_.width(),