diff --git a/src/ports/SkFontHost_fontconfig.cpp b/src/ports/SkFontHost_fontconfig.cpp index 1cd2dd9035..c53328b89b 100644 --- a/src/ports/SkFontHost_fontconfig.cpp +++ b/src/ports/SkFontHost_fontconfig.cpp @@ -154,7 +154,9 @@ SkStream* FontConfigTypeface::onOpenStream(int* ttcIndex) const { SkAutoTMalloc allocMemory(length); stream->rewind(); if (length == stream->read(allocMemory.get(), length)) { - return new SkMemoryStream(allocMemory.detach(), length); + SkAutoTUnref copyStream(new SkMemoryStream()); + copyStream->setMemoryOwned(allocMemory.detach(), length); + return copyStream.detach(); } stream->rewind();