src/solaris/native/sun/awt/awt_Font.c
Print this page
*** 538,547 ****
--- 538,560 ----
if (fdata->flist[i].xfont != NULL) {
fdata->flist[i].load = 1;
fdata->xfont = fdata->flist[i].xfont;
fdata->flist[i].index_length = 1;
} else {
+ /* Free any already allocated storage and fonts */
+ int j = i;
+ for (j = 0; j <= i; j++) {
+ free((void *)fdata->flist[j].xlfd);
+ JNU_ReleaseStringPlatformChars(env, NULL,
+ fdata->flist[j].charset_name);
+ if (fdata->flist[j].load) {
+ XFreeFont(awt_display, fdata->flist[j].xfont);
+ }
+ }
+ free((void *)fdata->flist);
+ free((void *)fdata);
+
if (errmsg != NULL) {
*errmsg = "java/lang" "NullPointerException";
}
(*env)->DeleteLocalRef(env, componentFonts);
return NULL;