Fix memory leak in nanobench
authorrobertphillips <robertphillips@google.com>
Fri, 21 Nov 2014 14:53:00 +0000 (06:53 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 21 Nov 2014 14:53:00 +0000 (06:53 -0800)
This is cleanup for (Add MultiPictureDraw to nanobench - https://codereview.chromium.org/731973005/)

Review URL: https://codereview.chromium.org/730343003

bench/SKPBench.cpp

index fd8df429c2ad7ccb088f48e7c570a05628118039..3e692171dbbb1bb46888bcb2838cde46fcb8063b 100644 (file)
@@ -73,7 +73,8 @@ void SKPBench::onPerCanvasPostDraw(SkCanvas* canvas) {
     // Draw the last set of tiles into the master canvas in case we're
     // saving the images
     for (int i = 0; i < fTileRects.count(); ++i) {
-        canvas->drawImage(fSurfaces[i]->newImageSnapshot(),
+        SkAutoTUnref<SkImage> image(fSurfaces[i]->newImageSnapshot());
+        canvas->drawImage(image,
                           SkIntToScalar(fTileRects[i].fLeft), SkIntToScalar(fTileRects[i].fTop));
         SkSafeSetNull(fSurfaces[i]);
     }