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()); |
} |