aboutsummaryrefslogtreecommitdiffstats
path: root/java
diff options
context:
space:
mode:
authorglewis <glewis@FreeBSD.org>2016-06-16 14:24:34 +0800
committerglewis <glewis@FreeBSD.org>2016-06-16 14:24:34 +0800
commit0e24319cfb46434af118843bdd5037c3df645883 (patch)
treefbf8f2733bdb20a1ae641486e9155303361de612 /java
parent78883f4516f06461263ba7e448ae9473f97c2b08 (diff)
downloadfreebsd-ports-gnome-0e24319cfb46434af118843bdd5037c3df645883.tar.gz
freebsd-ports-gnome-0e24319cfb46434af118843bdd5037c3df645883.tar.zst
freebsd-ports-gnome-0e24319cfb46434af118843bdd5037c3df645883.zip
. Fix a double free bug. This is pulled from upstream.
. Bump PORTREVISION. PR: 210226 Submitted by: girgen@
Diffstat (limited to 'java')
-rw-r--r--java/openjdk8/Makefile2
-rw-r--r--java/openjdk8/files/patch-jdk-src-share-native-sun-font-freetypeScaler.c52
2 files changed, 53 insertions, 1 deletions
diff --git a/java/openjdk8/Makefile b/java/openjdk8/Makefile
index e40895756525..59b4329b0723 100644
--- a/java/openjdk8/Makefile
+++ b/java/openjdk8/Makefile
@@ -2,7 +2,7 @@
PORTNAME= openjdk
PORTVERSION= ${JDK_MAJOR_VERSION}.${JDK_UPDATE_VERSION}.${JDK_BUILD_NUMBER:S/^0//}
-PORTREVISION= 2
+PORTREVISION= 3
CATEGORIES= java devel
MASTER_SITES= http://download.java.net/openjdk/jdk${JDK_MAJOR_VERSION}/promoted/b${DIST_BUILD_NUMBER}/:jdk \
https://adopt-openjdk.ci.cloudbees.com/job/jtreg/${JTREG_JENKINS_BUILD}/artifact/:jtreg \
diff --git a/java/openjdk8/files/patch-jdk-src-share-native-sun-font-freetypeScaler.c b/java/openjdk8/files/patch-jdk-src-share-native-sun-font-freetypeScaler.c
new file mode 100644
index 000000000000..093996a80087
--- /dev/null
+++ b/java/openjdk8/files/patch-jdk-src-share-native-sun-font-freetypeScaler.c
@@ -0,0 +1,52 @@
+--- jdk/src/share/native/sun/font/freetypeScaler.c
++++ jdk/src/share/native/sun/font/freetypeScaler.c
+@@ -60,6 +60,7 @@
+ JNIEnv* env;
+ FT_Library library;
+ FT_Face face;
++ FT_Stream faceStream;
+ jobject font2D;
+ jobject directBuffer;
+
+@@ -107,15 +108,10 @@
+ if (scalerInfo == NULL)
+ return;
+
+- //apparently Done_Face will only close the stream
+- // but will not relase the memory of stream structure.
+- // We need to free it explicitly to avoid leak.
+- //Direct access to the stream field might be not ideal solution as
+- // it is considred to be "private".
+- //Alternatively we could have stored pointer to the structure
+- // in the scalerInfo but this will increase size of the structure
+- // for no good reason
+- stream = scalerInfo->face->stream;
++ // FT_Done_Face always closes the stream, but only frees the memory
++ // of the data structure if it was internally allocated by FT.
++ // We hold on to a pointer to the stream structure if we provide it
++ // ourselves, so that we can free it here.
+
+ FT_Done_Face(scalerInfo->face);
+ FT_Done_FreeType(scalerInfo->library);
+@@ -128,8 +124,8 @@
+ free(scalerInfo->fontData);
+ }
+
+- if (stream != NULL) {
+- free(stream);
++ if (scalerInfo->faceStream != NULL) {
++ free(scalerInfo->faceStream);
+ }
+
+ free(scalerInfo);
+@@ -302,6 +298,10 @@
+ &ft_open_args,
+ indexInCollection,
+ &scalerInfo->face);
++
++ if (!error) {
++ scalerInfo->faceStream = ftstream;
++ }
+ }
+ if (error || scalerInfo->directBuffer == NULL) {
+ free(ftstream);