summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNeil Fortner <nfortne2@hdfgroup.org>2009-09-25 18:09:06 (GMT)
committerNeil Fortner <nfortne2@hdfgroup.org>2009-09-25 18:09:06 (GMT)
commit260d1d3873cacd366ed062cb2b562fffd8825fbf (patch)
tree5ea1f9de5191254920f6a1d700490afcb5da7fcc /src
parentf1cf5ab7aa2aad3df6f77d93ef951c034ff723ba (diff)
downloadhdf5-260d1d3873cacd366ed062cb2b562fffd8825fbf.zip
hdf5-260d1d3873cacd366ed062cb2b562fffd8825fbf.tar.gz
hdf5-260d1d3873cacd366ed062cb2b562fffd8825fbf.tar.bz2
[svn-r17530] Purpose: Fix bug 1555
Description: At several places in H5Pint.c properties were being compared using memcmp, not using the registered "cmp" callback. This could cause memory checkers to report uninitialized memory errors, and could conceivably cause runtime errors if memcmp reported false equality (for example if a value pointed to by the property changed). The code has been changed to always use the cmp callback. Tests have been added that check this in all the places that previously used memcmp. Tested: jam, linew, smirom (h5committest)
Diffstat (limited to 'src')
-rw-r--r--src/H5Pint.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/H5Pint.c b/src/H5Pint.c
index 56f1929..364cab2 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -277,7 +277,7 @@ H5P_do_prop_cb1(H5SL_t *slist, H5P_genprop_t *prop, H5P_prp_cb1_t cb)
HGOTO_ERROR (H5E_PLIST, H5E_CANTINIT, FAIL,"Property callback failed");
/* Check if the property value changed */
- if(HDmemcmp(tmp_value,prop->value,prop->size)) {
+ if((prop->cmp)(tmp_value,prop->value,prop->size)) {
/* Make a copy of the class's property */
if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL)
HGOTO_ERROR (H5E_PLIST, H5E_CANTCOPY, FAIL,"Can't copy property");
@@ -2264,7 +2264,7 @@ H5P_set(H5P_genplist_t *plist, const char *name, const void *value)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value");
} /* end if */
- if(HDmemcmp(tmp_value,prop->value,prop->size)) {
+ if((prop->cmp)(tmp_value,prop->value,prop->size)) {
/* Make a copy of the class's property */
if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL)
HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property");
@@ -2282,7 +2282,7 @@ H5P_set(H5P_genplist_t *plist, const char *name, const void *value)
} /* end if */
/* No 'set' callback, just copy value */
else {
- if(HDmemcmp(value,prop->value,prop->size)) {
+ if((prop->cmp)(value,prop->value,prop->size)) {
/* Make a copy of the class's property */
if((pcopy=H5P_dup_prop(prop,H5P_PROP_WITHIN_LIST)) == NULL)
HGOTO_ERROR(H5E_PLIST,H5E_CANTCOPY,FAIL,"Can't copy property");
@@ -3614,7 +3614,7 @@ H5P_get(const H5P_genplist_t *plist, const char *name, void *value)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "can't set property value");
} /* end if */
- if(HDmemcmp(tmp_value,prop->value,prop->size)) {
+ if((prop->cmp)(tmp_value,prop->value,prop->size)) {
H5P_genprop_t *pcopy; /* Copy of property to insert into skip list */
/* Make a copy of the class's property */