mirror of
https://github.com/HDFGroup/hdf5.git
synced 2024-11-27 02:10:55 +08:00
[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
This commit is contained in:
parent
cade98122a
commit
92bbd705f1
@ -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<buf[idx].len-1; jj++)
|
||||
{
|
||||
((hobj_ref_t *)buf[idx].p)[jj] = ((hobj_ref_t *)buf[idx].p)[jj+1];
|
||||
}
|
||||
|
||||
buf[idx].len--;
|
||||
|
||||
len = buf[idx].len;
|
||||
buf[idx].p = realloc( buf[idx].p, len * sizeof(hobj_ref_t));
|
||||
|
||||
found_ds = 1;
|
||||
|
||||
|
||||
/* close the dereferenced dataset and break */
|
||||
if (H5Dclose(dsid_j) < 0)
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user