Stop bench from leaking
Review URL: http://codereview.appspot.com/6465045/
git-svn-id: http://skia.googlecode.com/svn/trunk@5072 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/bench/benchmain.cpp b/bench/benchmain.cpp
index 0ea48e9..73aa988 100644
--- a/bench/benchmain.cpp
+++ b/bench/benchmain.cpp
@@ -374,6 +374,7 @@
if (*contextHeight < dim.fY) {
*contextHeight = dim.fY;
}
+ bench->unref();
}
}
@@ -737,6 +738,8 @@
Iter iter(&defineDict);
SkBenchmark* bench;
while ((bench = iter.next()) != NULL) {
+ SkAutoTUnref<SkBenchmark> benchUnref(bench);
+
SkIPoint dim = bench->getSize();
if (dim.fX <= 0 || dim.fY <= 0) {
continue;