Close a couple of minor memory leaks, add a valgrind suppression file to
mute complaints about apparent driver bugs.
http://codereview.appspot.com/5837046/
git-svn-id: http://skia.googlecode.com/svn/trunk@3406 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/AAClipTest.cpp b/tests/AAClipTest.cpp
index 4f3f759..4817c06 100644
--- a/tests/AAClipTest.cpp
+++ b/tests/AAClipTest.cpp
@@ -276,6 +276,8 @@
SkMask maskBW, maskAA;
copyToMask(rgn2, &maskBW);
clip2.copyToMask(&maskAA);
+ SkAutoMaskFreeImage freeBW(maskBW.fImage);
+ SkAutoMaskFreeImage freeAA(maskAA.fImage);
REPORTER_ASSERT(reporter, maskBW == maskAA);
}
}
@@ -308,7 +310,8 @@
SkMask mask;
clip.copyToMask(&mask);
-
+ SkAutoMaskFreeImage freeM(mask.fImage);
+
REPORTER_ASSERT(reporter, expected == mask);
}
}
diff --git a/tests/BitmapCopyTest.cpp b/tests/BitmapCopyTest.cpp
index d5fd7df..27a145e 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -474,7 +474,8 @@
// raw buffer pointer.
const uint32_t bufSize = subH *
SkBitmap::ComputeRowBytes(src.getConfig(), subW) * 2;
- uint8_t* buf = new uint8_t[bufSize];
+ SkAutoMalloc autoBuf (bufSize);
+ uint8_t* buf = static_cast<uint8_t*>(autoBuf.get());
SkBitmap bufBm; // Attach buf to this bitmap.
bool successExpected;
@@ -593,7 +594,6 @@
subset.copyPixelsFrom(buf, 1, subset.rowBytes()) ==
false);
- delete [] buf;
#endif
}
}
diff --git a/tests/valgrind.supp b/tests/valgrind.supp
new file mode 100644
index 0000000..4539c94
--- /dev/null
+++ b/tests/valgrind.supp
@@ -0,0 +1,16 @@
+# Pass this file to Valgrind with "--suppressions=tests/valgrind.supp"
+# to avoid reporting errors inside the driver.
+
+{
+ nVidiaDriverUninitializedJump001
+ Memcheck:Cond
+ obj:/usr/lib/nvidia-current/libnvidia-glcore.so.280.13
+}
+{
+ nVidiaDriverLeak001
+ Memcheck:Leak
+ fun:malloc
+ obj:/usr/lib/nvidia-current/libGL.so.280.13
+}
+
+