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

Unified Diff: tests/SerializationTest.cpp

Issue 195763025: fix a leak (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: AnotherPatchSet Created 6 years, 9 months 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/SerializationTest.cpp
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index 2ddd368433ba2e17fc0b02fbd78d3eb0cf3fc9ce..dfc7afa4fc4ef3c4365129dc4414edbf89c3e18a 100644
--- a/tests/SerializationTest.cpp
+++ b/tests/SerializationTest.cpp
@@ -9,6 +9,7 @@
#include "SkBitmapSource.h"
#include "SkCanvas.h"
#include "SkMallocPixelRef.h"
+#include "SkTemplates.h"
#include "SkWriteBuffer.h"
#include "SkValidatingReadBuffer.h"
#include "SkXfermodeImageFilter.h"
@@ -378,11 +379,11 @@ DEF_TEST(Serialization, reporter) {
SkWriteBuffer writer(SkWriteBuffer::kValidation_Flag);
pict->flatten(writer);
size_t size = writer.bytesWritten();
- void* data = sk_malloc_throw(size);
- writer.writeToMemory(data);
+ SkAutoTMalloc<unsigned char> data(size);
+ writer.writeToMemory(static_cast<void*>(data.get()));
// Deserialize picture
- SkValidatingReadBuffer reader(data, size);
+ SkValidatingReadBuffer reader(static_cast<void*>(data.get()), size);
SkAutoTUnref<SkPicture> readPict(
SkPicture::CreateFromBuffer(reader));
REPORTER_ASSERT(reporter, NULL != readPict.get());
« 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