diff options
-rw-r--r-- | src/core/SkTypeface.cpp | 5 |
1 files 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<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 { |