From c51db02181982fbcb8888e2a89132363a7d9371c Mon Sep 17 00:00:00 2001 From: scroggo Date: Thu, 16 Aug 2012 20:30:18 +0000 Subject: [PATCH] Fix a memory leak in SkBitmapHeap. When I switched fLookupTable to be an array of pointers, I did not delete those pointers when I was done with them. Do it now. Also modify SkTDArray::deleteAll to call SkDELETE instead of delete. Review URL: https://codereview.appspot.com/6453129 git-svn-id: http://skia.googlecode.com/svn/trunk@5137 2bbb7eff-a529-9590-31e7-b0007b416f81 --- include/core/SkTDArray.h | 2 +- src/core/SkBitmapHeap.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/core/SkTDArray.h b/include/core/SkTDArray.h index 60c987d93..2d7ec186a 100644 --- a/include/core/SkTDArray.h +++ b/include/core/SkTDArray.h @@ -266,7 +266,7 @@ public: T* iter = fArray; T* stop = fArray + fCount; while (iter < stop) { - delete (*iter); + SkDELETE (*iter); iter += 1; } this->reset(); diff --git a/src/core/SkBitmapHeap.cpp b/src/core/SkBitmapHeap.cpp index 1867af21c..e7f9eed35 100644 --- a/src/core/SkBitmapHeap.cpp +++ b/src/core/SkBitmapHeap.cpp @@ -104,6 +104,7 @@ SkBitmapHeap::~SkBitmapHeap() { SkASSERT(0 == fBytesAllocated); fStorage.deleteAll(); SkSafeUnref(fExternalStorage); + fLookupTable.deleteAll(); } SkTRefArray* SkBitmapHeap::extractBitmaps() const {