summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRay Lu <songyulu@hdfgroup.org>2019-03-01 17:32:14 (GMT)
committerRay Lu <songyulu@hdfgroup.org>2019-03-01 17:32:14 (GMT)
commit5182e73d5e0ef7130622fb6f74449c947d7d8036 (patch)
treefdfeb1797dc05511819c625851d90050154eb8af /src
parentd2dfe6ccbe9a058577834728fc8ae79923c0e5b3 (diff)
parentb23079de3af4bfb7aa0508fb81aacd67a76c2114 (diff)
downloadhdf5-5182e73d5e0ef7130622fb6f74449c947d7d8036.zip
hdf5-5182e73d5e0ef7130622fb6f74449c947d7d8036.tar.gz
hdf5-5182e73d5e0ef7130622fb6f74449c947d7d8036.tar.bz2
Merge pull request #1588 in HDFFV/hdf5 from ~SONGYULU/hdf5_ray:HDFFV-10705-memory-leak-in-scale-offset to develop
* commit 'b23079de3af4bfb7aa0508fb81aacd67a76c2114': HDFFV-10705: Fixed memory leak in scale offset filter.
Diffstat (limited to 'src')
-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;