aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-15 18:16:39 +0000
committerGravatar tomhudson@google.com <tomhudson@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-03-15 18:16:39 +0000
commit0435f161fcb95ee4b2da32a28568eca59b300d16 (patch)
treec41c8153bed48e5185c7f74dfabe158ecaa2c19b
parent60361493548d5259d0a8afae84274c2a3c31dcac (diff)
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
-rw-r--r--tests/AAClipTest.cpp5
-rw-r--r--tests/BitmapCopyTest.cpp4
-rw-r--r--tests/valgrind.supp16
3 files changed, 22 insertions, 3 deletions
diff --git a/tests/AAClipTest.cpp b/tests/AAClipTest.cpp
index 4f3f7597f9..4817c06738 100644
--- a/tests/AAClipTest.cpp
+++ b/tests/AAClipTest.cpp
@@ -276,6 +276,8 @@ static void test_irect(skiatest::Reporter* reporter) {
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 @@ static void test_path_with_hole(skiatest::Reporter* reporter) {
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 d5fd7df98f..27a145e065 100644
--- a/tests/BitmapCopyTest.cpp
+++ b/tests/BitmapCopyTest.cpp
@@ -474,7 +474,8 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) {
// 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 @@ static void TestBitmapCopy(skiatest::Reporter* reporter) {
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 0000000000..4539c94997
--- /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
+}
+
+