diff options
author | Quincey Koziol <koziol@hdfgroup.org> | 2003-11-08 15:32:53 (GMT) |
---|---|---|
committer | Quincey Koziol <koziol@hdfgroup.org> | 2003-11-08 15:32:53 (GMT) |
commit | 0497e80b5017f0292a3232cfec4e268f9776d137 (patch) | |
tree | adf245ba8f035a20cb91e688a2529e439674634c /test/istore.c | |
parent | dd969f1eadfd2cd500f3f44415b85cfea7216794 (diff) | |
download | hdf5-0497e80b5017f0292a3232cfec4e268f9776d137.zip hdf5-0497e80b5017f0292a3232cfec4e268f9776d137.tar.gz hdf5-0497e80b5017f0292a3232cfec4e268f9776d137.tar.bz2 |
[svn-r7829] Purpose:
Bug fix & code cleanup
Description:
Allowing the library to call malloc with a size of 0 bytes causes problems
for some users, so we check for allocations of 0 bytes and disallow them now.
Cleaned up some code which could call malloc with 0 size.
Changed some code calling HDmalloc directly to call H5MM_malloc(), which
allows us to check for 0 sized allocations.
Platforms tested:
FreeBSD 4.9 (sleipnir)
too minor to require h5committest
Diffstat (limited to 'test/istore.c')
-rw-r--r-- | test/istore.c | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/test/istore.c b/test/istore.c index b1c2453..7de1d90 100644 --- a/test/istore.c +++ b/test/istore.c @@ -28,7 +28,6 @@ #include "H5Pprivate.h" #include "H5Fpkg.h" #include "H5Gprivate.h" -#include "H5MMprivate.h" #include "H5Oprivate.h" #include "H5Pprivate.h" #include "H5Vprivate.h" @@ -253,9 +252,9 @@ test_extend(hid_t f, const char *prefix, sprintf(s, "istore extend: %s", dims); TESTING(s); - buf = H5MM_malloc(nx * ny * nz); - check = H5MM_malloc(nx * ny * nz); - whole = H5MM_calloc(nx*ny*nz); + buf = HDmalloc(nx * ny * nz); + check = HDmalloc(nx * ny * nz); + whole = HDcalloc(1,nx*ny*nz); whole_size[0] = nx; whole_size[1] = ny; @@ -401,17 +400,17 @@ test_extend(hid_t f, const char *prefix, if(H5Dclose(dataset)<0) TEST_ERROR; /* Free memory used */ - H5MM_xfree(buf); - H5MM_xfree(check); - H5MM_xfree(whole); + HDfree(buf); + HDfree(check); + HDfree(whole); PASSED(); return SUCCEED; error: - H5MM_xfree(buf); - H5MM_xfree(check); - H5MM_xfree(whole); + HDfree(buf); + HDfree(check); + HDfree(whole); return FAIL; } @@ -467,7 +466,7 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, sprintf(s, "istore sparse: %s", dims); TESTING(s); - buf = H5MM_malloc(nx * ny * nz); + buf = HDmalloc(nx * ny * nz); HDmemset(buf, 128, nx * ny * nz); /* Set dimensions of dataset */ @@ -534,12 +533,12 @@ test_sparse(hid_t f, const char *prefix, size_t nblocks, /* Close dataset */ if(H5Dclose(dataset)<0) TEST_ERROR; - H5MM_xfree(buf); + HDfree(buf); PASSED(); return SUCCEED; error: - H5MM_xfree(buf); + HDfree(buf); return FAIL; } |