Fix leak in SkFontHost_fontconfig temporary code.

https://codereview.chromium.org/16525003


git-svn-id: http://skia.googlecode.com/svn/trunk@9460 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
bungeman@google.com 2013-06-06 17:25:42 +00:00
parent 19e80c16a5
commit 88605bb51d

View File

@ -154,7 +154,9 @@ SkStream* FontConfigTypeface::onOpenStream(int* ttcIndex) const {
SkAutoTMalloc<uint8_t> allocMemory(length);
stream->rewind();
if (length == stream->read(allocMemory.get(), length)) {
return new SkMemoryStream(allocMemory.detach(), length);
SkAutoTUnref<SkMemoryStream> copyStream(new SkMemoryStream());
copyStream->setMemoryOwned(allocMemory.detach(), length);
return copyStream.detach();
}
stream->rewind();