From 92bbd705f1fabb4d7ad8527133d26ed4e9bf5df4 Mon Sep 17 00:00:00 2001 From: Pedro Vicente Nunes Date: Tue, 7 Apr 2009 09:56:08 -0500 Subject: [svn-r16676] #1521 (B2) H5DSdetach_scale memory leak ISSUE: Purify (Windows Visual Studio 6) complains of a memory leak in H5DSdetach_scale call regarding a H5Aread call (stack is H5A_read, H5T_convert, H5T_conv_vlen, H5T_vlen_seq_mem_write, H5MM_malloc). SOLUTION: When a scale is detached from a dataset, the variable length structure length field is decreased in one entry. The associated pointer must be reallocated with the new length. DOCS AND TEST: Nothing added tested: windows with purify, linux --- hl/src/H5DS.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/hl/src/H5DS.c b/hl/src/H5DS.c index 83bb1ed..10e552b 100644 --- a/hl/src/H5DS.c +++ b/hl/src/H5DS.c @@ -749,13 +749,21 @@ herr_t H5DSdetach_scale(hid_t did, goto out; /* same object, reset */ - if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr) { + if(oi1.fileno == oi2.fileno && oi1.addr == oi2.addr) + { + size_t len; + for(jj=j; jj