Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openanolis
dragonwell8_jdk
提交
6bce7731
D
dragonwell8_jdk
项目概览
openanolis
/
dragonwell8_jdk
通知
4
Star
2
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dragonwell8_jdk
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
6bce7731
编写于
7月 26, 2016
作者:
V
vadim
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
8161733: [parfait] Memory leak in imageioJPEG.c:2803
Reviewed-by: prr, serb
上级
42bd8099
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
33 addition
and
29 deletion
+33
-29
src/share/native/sun/awt/image/jpeg/imageioJPEG.c
src/share/native/sun/awt/image/jpeg/imageioJPEG.c
+33
-29
未找到文件。
src/share/native/sun/awt/image/jpeg/imageioJPEG.c
浏览文件 @
6bce7731
...
...
@@ -2634,6 +2634,18 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeTables
RELEASE_ARRAYS
(
env
,
data
,
NULL
);
}
static
void
freeArray
(
void
**
arr
,
jint
size
)
{
int
i
;
if
(
arr
!=
NULL
)
{
for
(
i
=
0
;
i
<
size
;
i
++
)
{
if
(
arr
[
i
]
!=
NULL
)
{
free
(
arr
[
i
]);
}
}
free
(
arr
);
}
}
JNIEXPORT
jboolean
JNICALL
Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage
(
JNIEnv
*
env
,
...
...
@@ -2742,6 +2754,8 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage
scale
=
(
UINT8
**
)
calloc
(
numBands
,
sizeof
(
UINT8
*
));
if
(
scale
==
NULL
)
{
(
*
env
)
->
ReleaseIntArrayElements
(
env
,
bandSizes
,
bandSize
,
JNI_ABORT
);
JNU_ThrowByName
(
env
,
"java/lang/OutOfMemoryError"
,
"Writing JPEG Stream"
);
return
JNI_FALSE
;
...
...
@@ -2758,6 +2772,8 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage
free
(
scale
[
j
]);
}
free
(
scale
);
(
*
env
)
->
ReleaseIntArrayElements
(
env
,
bandSizes
,
bandSize
,
JNI_ABORT
);
JNU_ThrowByName
(
env
,
"java/lang/OutOfMemoryError"
,
"Writing JPEG Stream"
);
return
JNI_FALSE
;
...
...
@@ -2782,21 +2798,14 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage
pb
=
&
data
->
pixelBuf
;
if
(
setPixelBuffer
(
env
,
pb
,
buffer
)
==
NOT_OK
)
{
if
(
scale
!=
NULL
)
{
for
(
i
=
0
;
i
<
numBands
;
i
++
)
{
if
(
scale
[
i
]
!=
NULL
)
{
free
(
scale
[
i
]);
}
}
free
(
scale
);
}
freeArray
(
scale
,
numBands
);
return
data
->
abortFlag
;
// We already threw an out of memory exception
}
// Allocate a 1-scanline buffer
scanLinePtr
=
(
JSAMPROW
)
malloc
(
scanLineSize
);
if
(
scanLinePtr
==
NULL
)
{
RELEASE_ARRAYS
(
env
,
data
,
(
const
JOCTET
*
)(
dest
->
next_output_byte
)
);
freeArray
(
scale
,
numBands
);
JNU_ThrowByName
(
env
,
"java/lang/OutOfMemoryError"
,
"Writing JPEG Stream"
);
...
...
@@ -2818,15 +2827,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage
JNU_ThrowByName
(
env
,
"javax/imageio/IIOException"
,
buffer
);
}
if
(
scale
!=
NULL
)
{
for
(
i
=
0
;
i
<
numBands
;
i
++
)
{
if
(
scale
[
i
]
!=
NULL
)
{
free
(
scale
[
i
]);
}
}
free
(
scale
);
}
freeArray
(
scale
,
numBands
);
free
(
scanLinePtr
);
return
data
->
abortFlag
;
}
...
...
@@ -2874,7 +2875,11 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage
if
(
qsels
)
{
(
*
env
)
->
ReleaseIntArrayElements
(
env
,
QtableSelectors
,
qsels
,
JNI_ABORT
);
}
if
(
!
success
)
return
data
->
abortFlag
;
if
(
!
success
)
{
freeArray
(
scale
,
numBands
);
free
(
scanLinePtr
);
return
data
->
abortFlag
;
}
jpeg_suppress_tables
(
cinfo
,
TRUE
);
// Disable writing any current
...
...
@@ -2892,6 +2897,8 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage
if
(
GET_ARRAYS
(
env
,
data
,
(
const
JOCTET
**
)(
&
dest
->
next_output_byte
))
==
NOT_OK
)
{
(
*
env
)
->
ExceptionClear
(
env
);
freeArray
(
scale
,
numBands
);
free
(
scanLinePtr
);
JNU_ThrowByName
(
env
,
"javax/imageio/IIOException"
,
"Array pin failed"
);
...
...
@@ -2926,7 +2933,12 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage
cinfo
->
scan_info
=
cinfo
->
script_space
;
scanptr
=
(
int
*
)
cinfo
->
script_space
;
scanData
=
(
*
env
)
->
GetIntArrayElements
(
env
,
scanInfo
,
NULL
);
CHECK_NULL_RETURN
(
scanData
,
data
->
abortFlag
);
if
(
scanData
==
NULL
)
{
RELEASE_ARRAYS
(
env
,
data
,
(
const
JOCTET
*
)(
dest
->
next_output_byte
));
freeArray
(
scale
,
numBands
);
free
(
scanLinePtr
);
return
data
->
abortFlag
;
}
// number of jints per scan is 9
// We avoid a memcpy to handle different size ints
for
(
i
=
0
;
i
<
numScans
*
9
;
i
++
)
{
...
...
@@ -3022,15 +3034,7 @@ Java_com_sun_imageio_plugins_jpeg_JPEGImageWriter_writeImage
jpeg_abort
((
j_common_ptr
)
cinfo
);
}
if
(
scale
!=
NULL
)
{
for
(
i
=
0
;
i
<
numBands
;
i
++
)
{
if
(
scale
[
i
]
!=
NULL
)
{
free
(
scale
[
i
]);
}
}
free
(
scale
);
}
freeArray
(
scale
,
numBands
);
free
(
scanLinePtr
);
RELEASE_ARRAYS
(
env
,
data
,
NULL
);
return
data
->
abortFlag
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录