8031095: [Parfait] warning from jdk/src/solaris/native/sun/awt: memory leak

Reviewed-by: bae, jgodinez
This commit is contained in:
Phil Race 2014-04-04 11:18:28 -07:00
parent bc431c1b98
commit 13d8babca9

View File

@ -555,6 +555,19 @@ awtJNI_GetFontData(JNIEnv * env, jobject font, char **errmsg)
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";
}