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
This commit is contained in:
robertphillips@google.com 2013-05-10 17:22:48 +00:00
parent 94b284d719
commit 9e9dfa3a67

View File

@ -116,8 +116,9 @@ SkTypeface* SkTypeface::Deserialize(SkStream* stream) {
if (length > 0) {
void* addr = sk_malloc_flags(length, 0);
if (addr) {
SkAutoTUnref<SkStream> localStream(SkNEW_ARGS(SkMemoryStream,
(addr, length, false)));
SkAutoTUnref<SkMemoryStream> localStream(SkNEW(SkMemoryStream));
localStream->setMemoryOwned(addr, length);
if (stream->read(addr, length) == length) {
return SkTypeface::CreateFromStream(localStream.get());
} else {