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

Unified Diff: src/ports/SkFontConfigInterface_direct.cpp

Issue 19466004: Make the copy of fontconfig font names before freeing their memory. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 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/ports/SkFontConfigInterface_direct.cpp
===================================================================
--- src/ports/SkFontConfigInterface_direct.cpp (revision 10226)
+++ src/ports/SkFontConfigInterface_direct.cpp (working copy)
@@ -563,13 +563,20 @@
SkAutoMutexAcquire ac(mutex_);
FcPattern* pat = FcPatternCreate();
- FcObjectSet* os = FcObjectSetBuild (FC_FAMILY, (char *) 0);
+ SkAutoTCallVProc<FcPattern, FcPatternDestroy> autoDestroyPat(pat);
+ if (NULL == pat) {
+ return NULL;
+ }
+
+ FcObjectSet* os = FcObjectSetBuild(FC_FAMILY, (char *)0);
+ SkAutoTCallVProc<FcObjectSet, FcObjectSetDestroy> autoDestroyOs(os);
if (NULL == os) {
return NULL;
}
+
FcFontSet* fs = FcFontList(NULL, pat, os);
+ SkAutoTCallVProc<FcFontSet, FcFontSetDestroy> autoDestroyFs(fs);
if (NULL == fs) {
- FcObjectSetDestroy(os);
return NULL;
}
@@ -584,10 +591,6 @@
}
}
- FcFontSetDestroy(fs);
- FcObjectSetDestroy(os);
- FcPatternDestroy(pat);
-
return SkDataTable::NewCopyArrays((const void*const*)names.begin(),
sizes.begin(), names.count());
}
« 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