From 41440bc2dcb23289f46df4a723e9e7a476cbae6e Mon Sep 17 00:00:00 2001 From: Leon Arber Date: Thu, 23 Sep 2004 10:43:54 -0500 Subject: [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: --- src/H5Ztrans.c | 6 ++++++ 1 file changed, 6 insertions(+) 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") -- cgit v0.12