summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSongyu Lu <songyulu@hdfgroup.org>2019-02-28 20:36:38 (GMT)
committerSongyu Lu <songyulu@hdfgroup.org>2019-02-28 20:36:38 (GMT)
commitb23079de3af4bfb7aa0508fb81aacd67a76c2114 (patch)
treefdfeb1797dc05511819c625851d90050154eb8af
parentd2dfe6ccbe9a058577834728fc8ae79923c0e5b3 (diff)
downloadhdf5-b23079de3af4bfb7aa0508fb81aacd67a76c2114.zip
hdf5-b23079de3af4bfb7aa0508fb81aacd67a76c2114.tar.gz
hdf5-b23079de3af4bfb7aa0508fb81aacd67a76c2114.tar.bz2
HDFFV-10705: Fixed memory leak in scale offset filter.
-rw-r--r--src/H5Zscaleoffset.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index cdf31a4..0026749 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -1174,6 +1174,8 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value
/* special case: minbits equal to full precision */
if(minbits == p.size * 8) {
HDmemcpy(outbuf, (unsigned char*)(*buf)+buf_offset, size_out);
+ /* free the original buffer */
+ H5MM_xfree(*buf);
/* convert to dataset datatype endianness order if needed */
if(need_convert)
@@ -1272,6 +1274,9 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value
/* special case: minbits equal to full precision */
if(minbits == p.size * 8) {
HDmemcpy(outbuf + buf_offset, *buf, nbytes);
+ /* free the original buffer */
+ H5MM_xfree(*buf);
+
*buf = outbuf;
outbuf = NULL;
*buf_size = size_out;