6892493: potential memory leaks in 2D font code indentified by parfait
Reviewed-by: bae, igor
This commit is contained in:
parent
ef0c3851d3
commit
248c3bb784
@ -1120,6 +1120,7 @@ Java_sun_font_FontConfigManager_getFontConfig
|
|||||||
}
|
}
|
||||||
pattern = (*FcNameParse)((FcChar8 *)fcName);
|
pattern = (*FcNameParse)((FcChar8 *)fcName);
|
||||||
if (pattern == NULL) {
|
if (pattern == NULL) {
|
||||||
|
(*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
|
||||||
closeFontConfig(libfontconfig, JNI_FALSE);
|
closeFontConfig(libfontconfig, JNI_FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1136,6 +1137,8 @@ Java_sun_font_FontConfigManager_getFontConfig
|
|||||||
(*FcDefaultSubstitute)(pattern);
|
(*FcDefaultSubstitute)(pattern);
|
||||||
fontset = (*FcFontSort)(NULL, pattern, FcTrue, NULL, &result);
|
fontset = (*FcFontSort)(NULL, pattern, FcTrue, NULL, &result);
|
||||||
if (fontset == NULL) {
|
if (fontset == NULL) {
|
||||||
|
(*FcPatternDestroy)(pattern);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
|
||||||
closeFontConfig(libfontconfig, JNI_FALSE);
|
closeFontConfig(libfontconfig, JNI_FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1153,6 +1156,21 @@ Java_sun_font_FontConfigManager_getFontConfig
|
|||||||
file = (FcChar8**)calloc(nfonts, sizeof(FcChar8*));
|
file = (FcChar8**)calloc(nfonts, sizeof(FcChar8*));
|
||||||
if (family == NULL || styleStr == NULL ||
|
if (family == NULL || styleStr == NULL ||
|
||||||
fullname == NULL || file == NULL) {
|
fullname == NULL || file == NULL) {
|
||||||
|
if (family != NULL) {
|
||||||
|
free(family);
|
||||||
|
}
|
||||||
|
if (styleStr != NULL) {
|
||||||
|
free(styleStr);
|
||||||
|
}
|
||||||
|
if (fullname != NULL) {
|
||||||
|
free(fullname);
|
||||||
|
}
|
||||||
|
if (file != NULL) {
|
||||||
|
free(file);
|
||||||
|
}
|
||||||
|
(*FcPatternDestroy)(pattern);
|
||||||
|
(*FcFontSetDestroy)(fontset);
|
||||||
|
(*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
|
||||||
closeFontConfig(libfontconfig, JNI_FALSE);
|
closeFontConfig(libfontconfig, JNI_FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1179,6 +1197,14 @@ Java_sun_font_FontConfigManager_getFontConfig
|
|||||||
result = (*FcPatternGetCharSet)(fontPattern,
|
result = (*FcPatternGetCharSet)(fontPattern,
|
||||||
FC_CHARSET, 0, &charset);
|
FC_CHARSET, 0, &charset);
|
||||||
if (result != FcResultMatch) {
|
if (result != FcResultMatch) {
|
||||||
|
free(family);
|
||||||
|
free(family);
|
||||||
|
free(styleStr);
|
||||||
|
free(file);
|
||||||
|
(*FcPatternDestroy)(pattern);
|
||||||
|
(*FcFontSetDestroy)(fontset);
|
||||||
|
(*env)->ReleaseStringUTFChars(env,
|
||||||
|
fcNameStr, (const char*)fcName);
|
||||||
closeFontConfig(libfontconfig, JNI_FALSE);
|
closeFontConfig(libfontconfig, JNI_FALSE);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user