From 668d8d5aa3d169182254febff02b725eb5a433cf Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 22 May 2007 10:09:31 -0500 Subject: [svn-r13784] Description: Close memory leak in error situation for opening a dataset. Tested on: Linux/32 2.6 (chicago) Linux/64 2.6 (chicago2) --- src/H5D.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/H5D.c b/src/H5D.c index 932d453..cad1742 100644 --- a/src/H5D.c +++ b/src/H5D.c @@ -1939,8 +1939,14 @@ done: HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") } /* end if */ if(dataset->shared->type) { - if(H5I_dec_ref(dataset->shared->type_id) < 0) - HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype") + if(dataset->shared->type_id > 0) { + if(H5I_dec_ref(dataset->shared->type_id) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype") + } /* end if */ + else { + if(H5T_close(dataset->shared->type) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release datatype") + } /* end else */ } /* end if */ } /* end if */ -- cgit v0.12