diff options
author | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-10 17:22:48 +0000 |
---|---|---|
committer | robertphillips@google.com <robertphillips@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2013-05-10 17:22:48 +0000 |
commit | 9e9dfa3a677d8f5042bb87a1201434421e7de002 (patch) | |
tree | 8e81843bffcfe99ad8b4f857b9dd424d0ea8a915 /src | |
parent | 94b284d719ee5ccd3e2efbd1d7084ec554583bac (diff) |
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
Diffstat (limited to 'src')
-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 { |