Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Unified Diff: tests/BitmapHeapTest.cpp

Issue 715383003: Fix memory leak in BitmapHeapTest (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/BitmapHeapTest.cpp
diff --git a/tests/BitmapHeapTest.cpp b/tests/BitmapHeapTest.cpp
index f3385644bd132a33ff24c2d1571016711304fac6..c7d097278b3501a6765599642b34c16940f1a229 100644
--- a/tests/BitmapHeapTest.cpp
+++ b/tests/BitmapHeapTest.cpp
@@ -17,9 +17,15 @@
struct SimpleFlatController : public SkFlatController {
SimpleFlatController() : SkFlatController() {}
- virtual void* allocThrow(size_t bytes) SK_OVERRIDE { return sk_malloc_throw(bytes); }
- virtual void unalloc(void* ptr) SK_OVERRIDE { sk_free(ptr); }
+ ~SimpleFlatController() { fAllocations.freeAll(); }
+ virtual void* allocThrow(size_t bytes) SK_OVERRIDE {
+ fAllocations.push(sk_malloc_throw(bytes));
+ return fAllocations.top();
+ }
+ virtual void unalloc(void*) SK_OVERRIDE { }
void setBitmapStorage(SkBitmapHeap* h) { this->setBitmapHeap(h); }
+private:
+ SkTDArray<void*> fAllocations;
};
struct SkShaderTraits {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698