diff options
author | Leon Arber <larber@ncsa.uiuc.edu> | 2004-09-23 15:43:54 (GMT) |
---|---|---|
committer | Leon Arber <larber@ncsa.uiuc.edu> | 2004-09-23 15:43:54 (GMT) |
commit | 41440bc2dcb23289f46df4a723e9e7a476cbae6e (patch) | |
tree | bffc08ccc4f33c20d76bdb506d107475fd3d13b7 /src/H5Ztrans.c | |
parent | 9fc48a009786e78c1acf3ed7a5c74e1ef73e8b94 (diff) | |
download | hdf5-41440bc2dcb23289f46df4a723e9e7a476cbae6e.zip hdf5-41440bc2dcb23289f46df4a723e9e7a476cbae6e.tar.gz hdf5-41440bc2dcb23289f46df4a723e9e7a476cbae6e.tar.bz2 |
[svn-r9314] Purpose:
Bug fix
Description:
Fix for small memory leak that occurs when destroying the data transform
property. Forgot to free the array of pointers to the temorary data.
Solution:
Freed memory.
Platforms tested:
sol + eirene
Misc. update:
Diffstat (limited to 'src/H5Ztrans.c')
-rw-r--r-- | src/H5Ztrans.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c index f17319d..9e63fdc 100644 --- a/src/H5Ztrans.c +++ b/src/H5Ztrans.c @@ -1685,6 +1685,7 @@ H5Z_xform_create(const char *expr) if(isalpha(expr[i])) count++; } + /* When there are no "x"'s in the equation (ie, simple transform case), * we don't need to allocate any space since no array will have to be * stored */ @@ -1751,6 +1752,10 @@ H5Z_xform_destroy(H5Z_data_xform_t *data_xform_prop) /* Free the expression */ H5MM_xfree(data_xform_prop->xform_exp); + /* Free the pointers to the temp. arrays, if there are any */ + if(data_xform_prop->dat_val_pointers->num_ptrs > 0) + H5MM_xfree(data_xform_prop->dat_val_pointers->ptr_dat_val); + /* Free the data storage struct */ H5MM_xfree(data_xform_prop->dat_val_pointers); @@ -1811,6 +1816,7 @@ H5Z_xform_copy(H5Z_data_xform_t **data_xform_prop) if(isalpha(new_data_xform_prop->xform_exp[i])) count++; } + if(count > 0) if((new_data_xform_prop->dat_val_pointers->ptr_dat_val = (void*) HDcalloc(count, sizeof(void*))) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "unable to allocate memory for pointers in transform array") |