From 9e9dfa3a677d8f5042bb87a1201434421e7de002 Mon Sep 17 00:00:00 2001 From: "robertphillips@google.com" Date: Fri, 10 May 2013 17:22:48 +0000 Subject: [PATCH] Fix memory leak in SkTypeface.cpp https://codereview.chromium.org/14617019/ git-svn-id: http://skia.googlecode.com/svn/trunk@9099 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkTypeface.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/core/SkTypeface.cpp b/src/core/SkTypeface.cpp index 5bd9d165bb..cc60ca1809 100644 --- a/src/core/SkTypeface.cpp +++ b/src/core/SkTypeface.cpp @@ -116,8 +116,9 @@ SkTypeface* SkTypeface::Deserialize(SkStream* stream) { if (length > 0) { void* addr = sk_malloc_flags(length, 0); if (addr) { - SkAutoTUnref localStream(SkNEW_ARGS(SkMemoryStream, - (addr, length, false))); + SkAutoTUnref localStream(SkNEW(SkMemoryStream)); + localStream->setMemoryOwned(addr, length); + if (stream->read(addr, length) == length) { return SkTypeface::CreateFromStream(localStream.get()); } else {