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
This commit is contained in:
commit-bot@chromium.org 2014-03-14 21:22:22 +00:00
parent 69e6463792
commit 1e7ee999d4

View File

@ -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());