fix a leak
R=sugoi@chromium.org, bungeman@google.com
Author: halcanary@google.com
Review URL: https://codereview.chromium.org/195763025
git-svn-id: http://skia.googlecode.com/svn/trunk@13814 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/tests/SerializationTest.cpp b/tests/SerializationTest.cpp
index 2ddd368..dfc7afa 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 @@
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());