From 13d8babca9c2add597ff0773369161c2cd072834 Mon Sep 17 00:00:00 2001 From: Phil Race Date: Fri, 4 Apr 2014 11:18:28 -0700 Subject: [PATCH] 8031095: [Parfait] warning from jdk/src/solaris/native/sun/awt: memory leak Reviewed-by: bae, jgodinez --- jdk/src/solaris/native/sun/awt/awt_Font.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/jdk/src/solaris/native/sun/awt/awt_Font.c b/jdk/src/solaris/native/sun/awt/awt_Font.c index 74b3691822f..016048ec4e8 100644 --- a/jdk/src/solaris/native/sun/awt/awt_Font.c +++ b/jdk/src/solaris/native/sun/awt/awt_Font.c @@ -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"; }