< prev index next >
src/java.desktop/unix/native/common/awt/fontpath.c
Print this page
rev 56251 : 8230900: missing ReleaseStringUTFChars in java.desktop native code
*** 1,7 ****
/*
! * Copyright (c) 1998, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
--- 1,7 ----
/*
! * Copyright (c) 1998, 2019, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
*** 1177,1186 ****
--- 1177,1189 ----
pattern = (*FcNameParse)((FcChar8 *)fcName);
(*env)->ReleaseStringUTFChars(env, fcNameStr, (const char*)fcName);
(*env)->DeleteLocalRef(env, fcNameStr);
if (pattern == NULL) {
closeFontConfig(libfontconfig, JNI_FALSE);
+ if (locale) {
+ (*env)->ReleaseStringUTFChars(env, localeStr, (const char*)locale);
+ }
return;
}
/* locale may not usually be necessary as fontconfig appears to apply
* this anyway based on the user's environment. However we want
*** 1194,1203 ****
--- 1197,1209 ----
(*FcDefaultSubstitute)(pattern);
fontset = (*FcFontSort)(NULL, pattern, FcTrue, NULL, &result);
if (fontset == NULL) {
(*FcPatternDestroy)(pattern);
closeFontConfig(libfontconfig, JNI_FALSE);
+ if (locale) {
+ (*env)->ReleaseStringUTFChars(env, localeStr, (const char*)locale);
+ }
return;
}
/* fontconfig returned us "nfonts". If we are just getting the
* first font, we set nfont to zero. Otherwise we use "nfonts".
*** 1225,1234 ****
--- 1231,1243 ----
free(file);
}
(*FcPatternDestroy)(pattern);
(*FcFontSetDestroy)(fontset);
closeFontConfig(libfontconfig, JNI_FALSE);
+ if (locale) {
+ (*env)->ReleaseStringUTFChars(env, localeStr, (const char*)locale);
+ }
return;
}
fontCount = 0;
minGlyphs = 20;
if (debugMinGlyphsStr != NULL) {
*** 1267,1276 ****
--- 1276,1288 ----
free(styleStr);
free(file);
(*FcPatternDestroy)(pattern);
(*FcFontSetDestroy)(fontset);
closeFontConfig(libfontconfig, JNI_FALSE);
+ if (locale) {
+ (*env)->ReleaseStringUTFChars (env, localeStr, (const char*)locale);
+ }
return;
}
/* We don't want 20 or 30 fonts, so once we hit 10 fonts,
* then require that they really be adding value. Too many
*** 1321,1330 ****
--- 1333,1345 ----
free(styleStr);
free(file);
(*FcPatternDestroy)(pattern);
(*FcFontSetDestroy)(fontset);
closeFontConfig(libfontconfig, JNI_FALSE);
+ if (locale) {
+ (*env)->ReleaseStringUTFChars (env, localeStr, (const char*)locale);
+ }
return;
}
(*env)->SetObjectField(env,fcCompFontObj, fcAllFontsID, fcFontArr);
}
fn=0;
< prev index next >