Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(162)

Unified Diff: src/pdf/SkPDFFont.cpp

Issue 514313003: Fix memory leak in SkPDFType1Font (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/pdf/SkPDFFont.cpp
diff --git a/src/pdf/SkPDFFont.cpp b/src/pdf/SkPDFFont.cpp
index 652b56d706683d26a7f848e5ffafbc2b851ddd41..9e13053c60db85de10d61ed01637c8a89fb08473 100644
--- a/src/pdf/SkPDFFont.cpp
+++ b/src/pdf/SkPDFFont.cpp
@@ -1312,13 +1312,13 @@ bool SkPDFType1Font::addFontDescriptor(int16_t defaultWidth) {
size_t data SK_INIT_TO_AVOID_WARNING;
size_t trailer SK_INIT_TO_AVOID_WARNING;
SkAutoTUnref<SkStream> rawFontData(typeface()->openStream(&ttcIndex));
- SkData* fontData = handle_type1_stream(rawFontData.get(), &header, &data,
- &trailer);
- if (fontData == NULL) {
+ SkAutoTUnref<SkData> fontData(handle_type1_stream(rawFontData.get(), &header,
+ &data, &trailer));
+ if (fontData.get() == NULL) {
return false;
}
if (canEmbed()) {
- SkAutoTUnref<SkPDFStream> fontStream(new SkPDFStream(fontData));
+ SkAutoTUnref<SkPDFStream> fontStream(new SkPDFStream(fontData.get()));
addResource(fontStream.get());
fontStream->insertInt("Length1", header);
fontStream->insertInt("Length2", data);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698