summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2014-04-09 11:41:28 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2014-04-09 11:41:28 (GMT)
commita9110fa0d153eb644d2dac24b935aaf72e9d76ce (patch)
tree89148a248fce9f73a9e5bb3ee21d8771884adb31 /tools
parent7401da00f6508c8a629d299537e87d325267ad55 (diff)
downloadhdf5-a9110fa0d153eb644d2dac24b935aaf72e9d76ce.zip
hdf5-a9110fa0d153eb644d2dac24b935aaf72e9d76ce.tar.gz
hdf5-a9110fa0d153eb644d2dac24b935aaf72e9d76ce.tar.bz2
[svn-r25000] Bugfix: HDFFV-8639
h5diff segfaults with user's files Solution: Added a variable to indicate if real data are in the buffer and will call H5Dvlen_reclaim() only when real data are in the buffer. Tested: with the user provided data files and no more segmentaion fault. Also h5committ tested.
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5diff_attr.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/tools/lib/h5diff_attr.c b/tools/lib/h5diff_attr.c
index 44b623f..3078369 100644
--- a/tools/lib/h5diff_attr.c
+++ b/tools/lib/h5diff_attr.c
@@ -332,6 +332,8 @@ hsize_t diff_attr(hid_t loc1_id,
size_t msize2; /* memory size of memory type */
void *buf1=NULL; /* data buffer */
void *buf2=NULL; /* data buffer */
+ int buf1hasdata=0; /* buffer has data */
+ int buf2hasdata=0; /* buffer has data */
hsize_t nelmts1; /* number of elements in dataset */
int rank1; /* rank of dataset */
int rank2; /* rank of dataset */
@@ -455,8 +457,10 @@ hsize_t diff_attr(hid_t loc1_id,
}
if(H5Aread(attr1_id,mtype1_id,buf1) < 0)
goto error;
+ buf1hasdata = 1;
if(H5Aread(attr2_id,mtype2_id,buf2) < 0)
goto error;
+ buf2hasdata = 1;
/* format output string */
HDsnprintf(np1, sizeof(np1), "%s of <%s>", name1, path1);
@@ -504,8 +508,8 @@ hsize_t diff_attr(hid_t loc1_id,
if(TRUE == h5tools_detect_vlen(mtype1_id))
H5Dvlen_reclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
HDfree(buf1);
-
buf1 = NULL;
+
if(TRUE == h5tools_detect_vlen(mtype2_id))
H5Dvlen_reclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
HDfree(buf2);
@@ -539,12 +543,12 @@ hsize_t diff_attr(hid_t loc1_id,
error:
H5E_BEGIN_TRY {
if(buf1) {
- if(TRUE == h5tools_detect_vlen(mtype1_id))
+ if(buf1hasdata && TRUE == h5tools_detect_vlen(mtype1_id))
H5Dvlen_reclaim(mtype1_id, space1_id, H5P_DEFAULT, buf1);
HDfree(buf1);
} /* end if */
if(buf2) {
- if(TRUE == h5tools_detect_vlen(mtype2_id))
+ if(buf2hasdata && TRUE == h5tools_detect_vlen(mtype2_id))
H5Dvlen_reclaim(mtype2_id, space2_id, H5P_DEFAULT, buf2);
HDfree(buf2);
} /* end if */