summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMohamad Chaarawi <chaarawi@hdfgroup.org>2012-05-18 14:08:58 (GMT)
committerMohamad Chaarawi <chaarawi@hdfgroup.org>2012-05-18 14:08:58 (GMT)
commit7aaa1ad2297b8e109cbff503be0cc4e73ada0871 (patch)
tree24b893eec0e27f39b80da51de493d4f241a8bd06 /test
parent27535adaa934d4e2d0384428a72645c102dd88fa (diff)
downloadhdf5-7aaa1ad2297b8e109cbff503be0cc4e73ada0871.zip
hdf5-7aaa1ad2297b8e109cbff503be0cc4e73ada0871.tar.gz
hdf5-7aaa1ad2297b8e109cbff503be0cc4e73ada0871.tar.bz2
[svn-r22375] add a test to expose a memory leak when adding/removing the same property in property list multiple times.
fix that bug. test with h5committest
Diffstat (limited to 'test')
-rw-r--r--test/tgenprop.c42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/tgenprop.c b/test/tgenprop.c
index 5f9a69b..3dbaa14 100644
--- a/test/tgenprop.c
+++ b/test/tgenprop.c
@@ -1575,6 +1575,46 @@ test_genprop_class_addprop(void)
/****************************************************************
**
+** test_genprop_list_add_remove_prop(): Test adding then removing the
+** same properties to a standard HDF5 property list. This is testing
+** also for a memory leak that could be caused by not freeing the
+** removed property resources from the property list.
+**
+****************************************************************/
+static void
+test_genprop_list_add_remove_prop(void)
+{
+ hid_t pid; /* Property List ID */
+ herr_t ret; /* Generic return value */
+
+ /* Create a dataset creation property list */
+ pid = H5Pcreate(H5P_DATASET_CREATE);
+ CHECK(pid, FAIL, "H5Pcreate");
+
+ /* Insert temporary property into class (with no callbacks) */
+ ret = H5Pinsert2(pid, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK_I(ret, "H5Pinsert2");
+
+ /* Delete added property */
+ ret = H5Premove(pid, PROP1_NAME);
+ CHECK_I(ret, "H5Premove");
+
+ /* Insert temporary property into class (with no callbacks) */
+ ret = H5Pinsert2(pid, PROP1_NAME, PROP1_SIZE, PROP1_DEF_VALUE, NULL, NULL, NULL, NULL, NULL, NULL);
+ CHECK_I(ret, "H5Pinsert2");
+
+ /* Delete added property */
+ ret = H5Premove(pid, PROP1_NAME);
+ CHECK_I(ret, "H5Premove");
+
+ /* Close property list */
+ ret = H5Pclose(pid);
+ CHECK(ret, FAIL, "H5Pclose");
+
+} /* end test_genprop_list_add_remove_prop() */
+
+/****************************************************************
+**
** test_genprop_equal(): Test basic generic property list code.
** More tests for H5Pequal()
**
@@ -1990,6 +2030,8 @@ test_genprop(void)
test_genprop_list_addprop(); /* Test adding properties to HDF5 property list */
test_genprop_class_addprop(); /* Test adding properties to HDF5 property class */
+ test_genprop_list_add_remove_prop(); /* Test adding and removing the same property several times to HDF5 property list */
+
test_genprop_equal(); /* Tests for more H5Pequal verification */
test_genprop_path(); /* Tests for class path verification */
test_genprop_refcount(); /* Tests for class reference counting */