summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--hl/src/H5LT.c59
-rw-r--r--hl/test/test_ds.c33
-rw-r--r--hl/test/test_file_image.c30
-rw-r--r--src/H5.c9
-rw-r--r--src/H5CX.c24
-rw-r--r--src/H5Dchunk.c5
-rw-r--r--src/H5FDhdfs.c2
-rw-r--r--src/H5FDmirror.c4
-rw-r--r--src/H5FDros3.c2
-rw-r--r--test/cache_common.c2
-rw-r--r--test/chunk_info.c7
-rw-r--r--test/cmpd_dset.c4
-rw-r--r--test/cross_read.c2
-rw-r--r--test/direct_chunk.c6
-rw-r--r--test/dsets.c42
-rw-r--r--test/dtypes.c56
-rw-r--r--test/file_image.c14
-rw-r--r--test/genall5.c20
-rw-r--r--test/h5test.c10
-rw-r--r--test/objcopy.c12
-rw-r--r--test/trefer_deprec.c6
-rw-r--r--test/use_common.c21
-rw-r--r--testpar/t_file.c5
-rw-r--r--testpar/t_span_tree.c5
-rw-r--r--tools/src/h5dump/h5dump_xml.c39
25 files changed, 303 insertions, 116 deletions
diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c
index fb507e7..1ef0f9d 100644
--- a/hl/src/H5LT.c
+++ b/hl/src/H5LT.c
@@ -2146,19 +2146,28 @@ realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, const char *str
size_t size_str_to_add, size_str;
if (_no_user_buf) {
+ char *tmp_realloc;
+
+ if (!buf)
+ goto out;
+
/* If the buffer isn't big enough, reallocate it. Otherwise, go to do strcat. */
if (str_to_add && ((ssize_t)(*len - (HDstrlen(buf) + HDstrlen(str_to_add) + 1)) < LIMIT)) {
*len += ((HDstrlen(buf) + HDstrlen(str_to_add) + 1) / INCREMENT + 1) * INCREMENT;
- buf = (char *)HDrealloc(buf, *len);
}
else if (!str_to_add && ((ssize_t)(*len - HDstrlen(buf) - 1) < LIMIT)) {
*len += INCREMENT;
- buf = (char *)HDrealloc(buf, *len);
}
- }
- if (!buf)
- goto out;
+ tmp_realloc = (char *)HDrealloc(buf, *len);
+ if (tmp_realloc == NULL) {
+ HDfree(buf);
+ buf = NULL;
+ goto out;
+ }
+ else
+ buf = tmp_realloc;
+ }
if (str_to_add) {
/* find the size of the buffer to add */
@@ -2374,9 +2383,9 @@ out:
herr_t
H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len)
{
- size_t str_len = INCREMENT;
- char * text_str;
- herr_t ret = SUCCEED;
+ size_t str_len = INCREMENT;
+ char * text_str = NULL;
+ herr_t ret = SUCCEED;
if (lang_type <= H5LT_LANG_ERR || lang_type >= H5LT_NO_LANG)
goto out;
@@ -2400,6 +2409,8 @@ H5LTdtype_to_text(hid_t dtype, char *str, H5LT_lang_t lang_type, size_t *len)
return ret;
out:
+ HDfree(text_str);
+
return FAIL;
}
@@ -2779,10 +2790,14 @@ next:
if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0)
goto out;
stmp = (char *)HDcalloc(super_len, sizeof(char));
- if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0)
+ if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) {
+ HDfree(stmp);
goto out;
- if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp)))
+ }
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) {
+ HDfree(stmp);
goto out;
+ }
if (stmp)
HDfree(stmp);
@@ -2822,10 +2837,14 @@ next:
if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0)
goto out;
stmp = (char *)HDcalloc(super_len, sizeof(char));
- if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0)
+ if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) {
+ HDfree(stmp);
goto out;
- if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp)))
+ }
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) {
+ HDfree(stmp);
goto out;
+ }
if (stmp)
HDfree(stmp);
@@ -2879,10 +2898,14 @@ next:
if (H5LTdtype_to_text(super, NULL, lang, &super_len) < 0)
goto out;
stmp = (char *)HDcalloc(super_len, sizeof(char));
- if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0)
+ if (H5LTdtype_to_text(super, stmp, lang, &super_len) < 0) {
+ HDfree(stmp);
goto out;
- if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp)))
+ }
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, stmp))) {
+ HDfree(stmp);
goto out;
+ }
if (stmp)
HDfree(stmp);
stmp = NULL;
@@ -2933,10 +2956,14 @@ next:
if (H5LTdtype_to_text(mtype, NULL, lang, &mlen) < 0)
goto out;
mtmp = (char *)HDcalloc(mlen, sizeof(char));
- if (H5LTdtype_to_text(mtype, mtmp, lang, &mlen) < 0)
+ if (H5LTdtype_to_text(mtype, mtmp, lang, &mlen) < 0) {
+ HDfree(mtmp);
goto out;
- if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, mtmp)))
+ }
+ if (!(dt_str = realloc_and_append(no_user_buf, slen, dt_str, mtmp))) {
+ HDfree(mtmp);
goto out;
+ }
if (mtmp)
HDfree(mtmp);
mtmp = NULL;
diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c
index ead5c65..786aba8 100644
--- a/hl/test/test_ds.c
+++ b/hl/test/test_ds.c
@@ -406,10 +406,10 @@ create_int_dataset(hid_t fid, const char *dsidx, int fulldims)
herr_t
create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldims)
{
- int rank = 4;
- int rankds = 1;
- hsize_t dims[4] = {DIM1_SIZE, DIM2_SIZE, DIM3_SIZE, DIM4_SIZE};
- long * buf;
+ int rank = 4;
+ int rankds = 1;
+ hsize_t dims[4] = {DIM1_SIZE, DIM2_SIZE, DIM3_SIZE, DIM4_SIZE};
+ long * buf = NULL;
hsize_t s1_dim[1] = {DIM1_SIZE};
hsize_t s2_dim[1] = {DIM2_SIZE};
hsize_t s3_dim[1] = {DIM3_SIZE};
@@ -431,49 +431,54 @@ create_long_dataset(hid_t fid, const char *dsname, const char *dsidx, int fulldi
/* Allocate buffer */
if (NULL == (buf = (long *)HDmalloc(sizeof(long) * DIM1_SIZE * DIM2_SIZE * DIM3_SIZE * DIM4_SIZE)))
- return FAIL;
+ goto error;
/* make a dataset */
if (H5LTmake_dataset_long(fid, dsname, rank, dims, buf) >= 0) {
if (fulldims == 0) {
/* make a DS dataset for the first dimension */
if (create_DS1_long_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, NULL) < 0)
- return FAIL;
+ goto error;
/* make a DS dataset for the second dimension */
if (create_DS2_long_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, NULL, NULL) < 0)
- return FAIL;
+ goto error;
/* make a DS dataset for the third dimension */
if (create_DS3_long_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, NULL, NULL, NULL) < 0)
- return FAIL;
+ goto error;
/* make a DS dataset for the fourth dimension */
if (create_DS4_long_datasets(fid, dsidx, rankds, s4_dim, s4_wbuf, NULL, NULL, NULL, NULL) < 0)
- return FAIL;
+ goto error;
}
else {
if (create_DS1_long_datasets(fid, dsidx, rankds, s1_dim, s1_wbuf, s11_wbuf) < 0)
- return FAIL;
+ goto error;
if (create_DS2_long_datasets(fid, dsidx, rankds, s2_dim, s2_wbuf, s21_wbuf, s22_wbuf) < 0)
- return FAIL;
+ goto error;
if (create_DS3_long_datasets(fid, dsidx, rankds, s3_dim, s3_wbuf, s31_wbuf, s32_wbuf, s33_wbuf) <
0)
- return FAIL;
+ goto error;
if (create_DS4_long_datasets(fid, dsidx, rankds, s4_dim, s4_wbuf, s41_wbuf, s42_wbuf, s43_wbuf,
s44_wbuf) < 0)
- return FAIL;
+ goto error;
}
}
else
- return FAIL;
+ goto error;
HDfree(buf);
return SUCCEED;
+
+error:
+ HDfree(buf);
+
+ return FAIL;
}
herr_t
diff --git a/hl/test/test_file_image.c b/hl/test/test_file_image.c
index b397a81..bde8adc 100644
--- a/hl/test/test_file_image.c
+++ b/hl/test/test_file_image.c
@@ -53,8 +53,8 @@
static int
test_file_image(size_t open_images, size_t nflags, const unsigned *flags)
{
- hid_t * file_id, *dset_id, file_space, plist; /* HDF5 ids */
- hsize_t dims1[RANK] = {2, 3}; /* original dimension of datasets */
+ hid_t * file_id = NULL, *dset_id = NULL, file_space, plist; /* HDF5 ids */
+ hsize_t dims1[RANK] = {2, 3}; /* original dimension of datasets */
hsize_t max_dims[RANK] = {H5S_UNLIMITED, H5S_UNLIMITED};
int data1[6] = {1, 2, 3, 4, 5, 6}; /* original contents of dataset */
int data2[6] = {7, 8, 9, 10, 11, 12}; /* "wrong" contents of dataset */
@@ -63,10 +63,10 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags)
hsize_t dims4[RANK] = {3, 5}; /* extended dimensions of datasets */
int data4[15] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
/* extended contents of dataset */
- ssize_t * buf_size; /* pointer to array of buffer sizes */
- void ** buf_ptr; /* pointer to array of pointers to image buffers */
- char ** filename; /* pointer to array of pointers to filenames */
- unsigned * input_flags; /* pointer to array of flag combinations */
+ ssize_t * buf_size = NULL; /* pointer to array of buffer sizes */
+ void ** buf_ptr = NULL; /* pointer to array of pointers to image buffers */
+ char ** filename = NULL; /* pointer to array of pointers to filenames */
+ unsigned * input_flags = NULL; /* pointer to array of flag combinations */
size_t i, j, k, nrow, n_values;
herr_t status1;
void * handle_ptr = NULL; /* pointers to driver buffer */
@@ -85,7 +85,7 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags)
FAIL_PUTS_ERROR("malloc() failed");
/* allocate array to store the name of each of the open images */
- if (NULL == (filename = (char **)HDmalloc(sizeof(char *) * open_images)))
+ if (NULL == (filename = (char **)HDcalloc(1, sizeof(char *) * open_images)))
FAIL_PUTS_ERROR("malloc() failed");
/* allocate array to store the size of each of the open images */
@@ -110,6 +110,8 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags)
/* allocate name buffer for image i */
filename[i] = (char *)HDmalloc(sizeof(char) * 32);
+ if (!filename[i])
+ FAIL_PUTS_ERROR("HDmalloc() failed");
/* create file name */
HDsprintf(filename[i], "image_file%d.h5", (int)i);
@@ -232,6 +234,9 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags)
if (input_flags[i] & H5LT_FILE_IMAGE_OPEN_RW && !(input_flags[i] & H5LT_FILE_IMAGE_DONT_COPY)) {
void *tmp_ptr = HDmalloc((size_t)buf_size[i]);
+ if (!tmp_ptr)
+ FAIL_PUTS_ERROR("buffer allocation failed");
+
/* Copy vfd buffer to a temporary buffer */
HDmemcpy(tmp_ptr, (void *)*core_buf_ptr_ptr, (size_t)buf_size[i]);
/* Clear status_flags in the superblock for the vfd buffer: file locking is using status_flags
@@ -525,6 +530,17 @@ test_file_image(size_t open_images, size_t nflags, const unsigned *flags)
return 0;
error:
+ if (filename) {
+ for (i = 0; i < open_images; i++)
+ HDfree(filename[i]);
+ HDfree(filename);
+ }
+ HDfree(file_id);
+ HDfree(dset_id);
+ HDfree(buf_ptr);
+ HDfree(buf_size);
+ HDfree(input_flags);
+
H5_FAILED();
return -1;
}
diff --git a/src/H5.c b/src/H5.c
index ce4a001..71a8a30 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -960,12 +960,9 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
* Check only the first sizeof(lib_str) char. Assume the information
* will fit within this size or enough significance.
*/
- HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d", H5_VERS_MAJOR, H5_VERS_MINOR,
- H5_VERS_RELEASE);
- if (*substr) {
- HDstrncat(lib_str, "-", (size_t)1);
- HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1);
- } /* end if */
+ HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d%s%s", H5_VERS_MAJOR,
+ H5_VERS_MINOR, H5_VERS_RELEASE, (*substr ? "-" : ""), substr);
+
if (HDstrcmp(lib_str, H5_lib_vers_info_g) != 0) {
HDfputs("Warning! Library version information error.\n"
"The HDF5 library version information are not "
diff --git a/src/H5CX.c b/src/H5CX.c
index ca30bdd..01bf435 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -1768,7 +1768,8 @@ H5CX_get_ring(void)
hbool_t
H5CX_get_coll_metadata_read(void)
{
- H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hbool_t coll_md_read = FALSE;
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1776,7 +1777,10 @@ H5CX_get_coll_metadata_read(void)
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.coll_metadata_read)
+ /* Set return value */
+ coll_md_read = (*head)->ctx.coll_metadata_read;
+
+ FUNC_LEAVE_NOAPI(coll_md_read)
} /* end H5CX_get_coll_metadata_read() */
/*-------------------------------------------------------------------------
@@ -1830,7 +1834,8 @@ done:
hbool_t
H5CX_get_mpi_file_flushing(void)
{
- H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hbool_t flushing = FALSE;
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1838,7 +1843,10 @@ H5CX_get_mpi_file_flushing(void)
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.mpi_file_flushing)
+ /* Set return value */
+ flushing = (*head)->ctx.mpi_file_flushing;
+
+ FUNC_LEAVE_NOAPI(flushing)
} /* end H5CX_get_mpi_file_flushing() */
/*-------------------------------------------------------------------------
@@ -1857,7 +1865,8 @@ H5CX_get_mpi_file_flushing(void)
hbool_t
H5CX_get_mpio_rank0_bcast(void)
{
- H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hbool_t do_rank0_bcast = FALSE;
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -1865,7 +1874,10 @@ H5CX_get_mpio_rank0_bcast(void)
head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.rank0_bcast)
+ /* Set return value */
+ do_rank0_bcast = (*head)->ctx.rank0_bcast;
+
+ FUNC_LEAVE_NOAPI(do_rank0_bcast)
} /* end H5CX_get_mpio_rank0_bcast() */
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 67ac99b..ccae784 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -4989,7 +4989,7 @@ H5D__chunk_collective_fill(const H5D_t *dset, H5D_chunk_coll_info_t *chunk_info,
* order of offset in the file.
*/
if (need_addr_sort)
- HDqsort(chunk_disp_array, blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr);
+ HDqsort(chunk_disp_array, (size_t)blocks, sizeof(MPI_Aint), H5D__chunk_cmp_addr);
/* MSC - should use this if MPI_type_create_hindexed block is working:
* mpi_code = MPI_Type_create_hindexed_block(blocks, block_len, chunk_disp_array, MPI_BYTE,
@@ -7478,14 +7478,13 @@ H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata)
const H5D_chunk_iter_ud_t *data = (H5D_chunk_iter_ud_t *)udata;
int ret_value = H5_ITER_CONT;
- FUNC_ENTER_STATIC
+ FUNC_ENTER_STATIC_NOERR
/* Check for callback failure and pass along return value */
if ((ret_value = (data->op)(chunk_rec->scaled, chunk_rec->filter_mask, chunk_rec->chunk_addr,
chunk_rec->nbytes, data->op_data)) < 0)
HERROR(H5E_DATASET, H5E_CANTNEXT, "iteration operator failed");
-done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_iter_cb */
diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c
index 5cd4a65..4712a8e 100644
--- a/src/H5FDhdfs.c
+++ b/src/H5FDhdfs.c
@@ -20,8 +20,10 @@
* File System (HDFS).
*/
+#ifdef H5_HAVE_LIBHDFS
/* This source code file is part of the H5FD driver module */
#include "H5FDdrvr_module.h"
+#endif
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c
index 00b5cd0..5711777 100644
--- a/src/H5FDmirror.c
+++ b/src/H5FDmirror.c
@@ -15,12 +15,12 @@
* a remote host.
*/
-#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */
-
#include "H5private.h" /* Generic Functions */
#ifdef H5_HAVE_MIRROR_VFD
+#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */
+
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
#include "H5FDprivate.h" /* File drivers */
diff --git a/src/H5FDros3.c b/src/H5FDros3.c
index 6e116ee..c0361f9 100644
--- a/src/H5FDros3.c
+++ b/src/H5FDros3.c
@@ -22,8 +22,10 @@
* Relies on "s3comms" utility layer to implement the AWS REST API.
*/
+#ifdef H5_HAVE_ROS3_VFD
/* This source code file is part of the H5FD driver module */
#include "H5FDdrvr_module.h"
+#endif
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
diff --git a/test/cache_common.c b/test/cache_common.c
index e86724f..0ddcbb8 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -4492,7 +4492,7 @@ col_major_scan_backward(H5F_t *file_ptr, int32_t max_index, int32_t lag, hbool_t
int mile_stone = 1;
int32_t type;
int32_t idx;
- int32_t local_max_index[NUMBER_OF_ENTRY_TYPES];
+ int32_t local_max_index[NUMBER_OF_ENTRY_TYPES] = {0};
if (verbose)
HDfprintf(stdout, "%s: entering.\n", FUNC);
diff --git a/test/chunk_info.c b/test/chunk_info.c
index 7440459..a1c4160 100644
--- a/test/chunk_info.c
+++ b/test/chunk_info.c
@@ -482,10 +482,10 @@ test_get_chunk_info_highest_v18(hid_t fapl)
unsigned flt_msk = 0; /* Filter mask */
unsigned read_flt_msk = 0; /* Filter mask after direct read */
int fillvalue = -1; /* Fill value */
- int aggression = 9; /* Compression aggression setting */
hsize_t offset[2] = {0, 0}; /* Offset coordinates of a chunk */
#ifdef H5_HAVE_FILTER_DEFLATE
- const Bytef *z_src = (const Bytef *)(direct_buf);
+ int aggression = 9; /* Compression aggression setting */
+ const Bytef *z_src = (const Bytef *)(direct_buf);
Bytef * z_dst; /* Destination buffer */
uLongf z_dst_nbytes = (uLongf)DEFLATE_SIZE_ADJUST(CHK_SIZE);
uLong z_src_nbytes = (uLong)CHK_SIZE;
@@ -568,7 +568,8 @@ test_get_chunk_info_highest_v18(hid_t fapl)
}
#else
/* Allocate input (non-compressed) buffer */
- inbuf = HDcalloc(1, CHK_SIZE);
+ if (NULL == (inbuf = HDcalloc(1, CHK_SIZE)))
+ TEST_ERROR
HDmemcpy(inbuf, direct_buf, CHK_SIZE);
#endif /* end H5_HAVE_FILTER_DEFLATE */
diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c
index e74b438..4c3233d 100644
--- a/test/cmpd_dset.c
+++ b/test/cmpd_dset.c
@@ -1466,6 +1466,10 @@ test_hdf5_src_subset(char *filename, hid_t fapl)
return 0;
error:
+ HDfree(orig);
+ HDfree(rbuf);
+ HDfree(rew_buf);
+
HDputs("*** DATASET TESTS FAILED ***");
return 1;
}
diff --git a/test/cross_read.c b/test/cross_read.c
index eef814f..cb71996 100644
--- a/test/cross_read.c
+++ b/test/cross_read.c
@@ -41,8 +41,10 @@ const char *FILENAME[] = {"vms_data", "le_data", "be_data", NULL};
#define DATASETNAME14 "Fletcher_float_data_le"
#define DATASETNAME15 "Fletcher_float_data_be"
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DATASETNAME16 "Deflate_float_data_le"
#define DATASETNAME17 "Deflate_float_data_be"
+#endif
#ifdef H5_HAVE_FILTER_SZIP
#define DATASETNAME18 "Szip_float_data_le"
#define DATASETNAME19 "Szip_float_data_be"
diff --git a/test/direct_chunk.c b/test/direct_chunk.c
index 0d270bd..8960784 100644
--- a/test/direct_chunk.c
+++ b/test/direct_chunk.c
@@ -23,7 +23,9 @@
#define FILE_NAME "direct_chunk.h5"
/* Datasets for Direct Write tests */
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DATASETNAME1 "direct_write"
+#endif
#define DATASETNAME2 "skip_one_filter"
#define DATASETNAME3 "skip_two_filters"
#define DATASETNAME4 "data_conv"
@@ -31,9 +33,11 @@
#define DATASETNAME6 "invalid_argue"
#define DATASETNAME7 "overwrite_chunk"
/* Datasets for Direct Read tests */
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DATASETNAME8 "disabled_chunk_cache"
#define DATASETNAME9 "flush_chunk_cache"
#define DATASETNAME10 "read_w_valid_cache"
+#endif
#define DATASETNAME11 "unallocated_chunk"
#define DATASETNAME12 "unfiltered_data"
@@ -43,7 +47,9 @@
#define CHUNK_NX 4
#define CHUNK_NY 4
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DEFLATE_SIZE_ADJUST(s) (HDceil(((double)(s)) * 1.001) + 12.0)
+#endif
/* Temporary filter IDs used for testing */
#define H5Z_FILTER_BOGUS1 305
diff --git a/test/dsets.c b/test/dsets.c
index cc35fe3..26322ad 100644
--- a/test/dsets.c
+++ b/test/dsets.c
@@ -95,25 +95,29 @@ const char *FILENAME[] = {"dataset", /* 0 */
#define FILE_DEFLATE_NAME "deflate.h5"
/* Dataset names for testing filters */
-#define DSET_DEFAULT_NAME "default"
-#define DSET_CHUNKED_NAME "chunked"
-#define DSET_COMPACT_NAME "compact"
-#define DSET_SIMPLE_IO_NAME "simple_io"
-#define DSET_USERBLOCK_IO_NAME "userblock_io"
-#define DSET_COMPACT_IO_NAME "compact_io"
-#define DSET_COMPACT_MAX_NAME "max_compact"
-#define DSET_COMPACT_MAX2_NAME "max_compact_2"
-#define DSET_CONV_BUF_NAME "conv_buf"
-#define DSET_TCONV_NAME "tconv"
-#define DSET_DEFLATE_NAME "deflate"
-#define DSET_SHUFFLE_NAME "shuffle"
-#define DSET_FLETCHER32_NAME "fletcher32"
-#define DSET_FLETCHER32_NAME_2 "fletcher32_2"
-#define DSET_FLETCHER32_NAME_3 "fletcher32_3"
+#define DSET_DEFAULT_NAME "default"
+#define DSET_CHUNKED_NAME "chunked"
+#define DSET_COMPACT_NAME "compact"
+#define DSET_SIMPLE_IO_NAME "simple_io"
+#define DSET_USERBLOCK_IO_NAME "userblock_io"
+#define DSET_COMPACT_IO_NAME "compact_io"
+#define DSET_COMPACT_MAX_NAME "max_compact"
+#define DSET_COMPACT_MAX2_NAME "max_compact_2"
+#define DSET_CONV_BUF_NAME "conv_buf"
+#define DSET_TCONV_NAME "tconv"
+#ifdef H5_HAVE_FILTER_DEFLATE
+#define DSET_DEFLATE_NAME "deflate"
+#endif
+#define DSET_SHUFFLE_NAME "shuffle"
+#define DSET_FLETCHER32_NAME "fletcher32"
+#define DSET_FLETCHER32_NAME_2 "fletcher32_2"
+#define DSET_FLETCHER32_NAME_3 "fletcher32_3"
+#ifdef H5_HAVE_FILTER_DEFLATE
#define DSET_SHUF_DEF_FLET_NAME "shuffle+deflate+fletcher32"
#define DSET_SHUF_DEF_FLET_NAME_2 "shuffle+deflate+fletcher32_2"
-#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space"
-#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type"
+#endif
+#define DSET_OPTIONAL_SCALAR "dataset_with_scalar_space"
+#define DSET_OPTIONAL_VLEN "dataset_with_vlen_type"
#ifdef H5_HAVE_FILTER_SZIP
#define DSET_SZIP_NAME "szip"
#define DSET_SHUF_SZIP_FLET_NAME "shuffle+szip+fletcher32"
@@ -1504,6 +1508,9 @@ test_conv_buffer(hid_t fid)
return SUCCEED;
error:
+ HDfree(cfrR);
+ HDfree(cf);
+
H5E_BEGIN_TRY
{
H5Pclose(xfer_list);
@@ -7162,6 +7169,7 @@ error:
H5E_END_TRY;
return FAIL;
#else
+ (void)file; /* Silence compiler */
SKIPPED();
return SUCCEED;
#endif
diff --git a/test/dtypes.c b/test/dtypes.c
index 52eb0ea..2a18302 100644
--- a/test/dtypes.c
+++ b/test/dtypes.c
@@ -783,9 +783,12 @@ test_compound_2(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->a = i * 8 + 0;
@@ -857,6 +860,10 @@ test_compound_2(void)
return 0;
error:
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -903,9 +910,12 @@ test_compound_3(void)
FAIL_STACK_ERROR
/* Initialize */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->a = i * 8 + 0;
@@ -973,6 +983,10 @@ test_compound_3(void)
return 0;
error:
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -1023,9 +1037,12 @@ test_compound_4(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->a = i * 8 + 0;
@@ -1096,6 +1113,10 @@ test_compound_4(void)
return 0;
error:
+ HDfree(buf);
+ HDfree(bkg);
+ HDfree(orig);
+
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -1146,6 +1167,12 @@ test_compound_5(void)
TESTING("optimized struct converter");
+ if (!buf || !bkg) {
+ HDfree(buf);
+ HDfree(bkg);
+ return 1;
+ }
+
/* Build datatypes */
short_array = H5Tcreate(H5T_COMPOUND, 4 * sizeof(short));
array_dt = H5Tarray_create2(H5T_NATIVE_SHORT, 1, dims);
@@ -1238,9 +1265,12 @@ test_compound_6(void)
FAIL_STACK_ERROR
/* Sizes should be the same, but be careful just in case */
- buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)));
- bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt));
- orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st));
+ if (NULL == (buf = (unsigned char *)HDmalloc(nelmts * MAX(sizeof(struct st), sizeof(struct dt)))))
+ goto error;
+ if (NULL == (bkg = (unsigned char *)HDmalloc(nelmts * sizeof(struct dt))))
+ goto error;
+ if (NULL == (orig = (unsigned char *)HDmalloc(nelmts * sizeof(struct st))))
+ goto error;
for (i = 0; i < (int)nelmts; i++) {
s_ptr = ((struct st *)((void *)orig)) + i;
s_ptr->b = (int16_t)((i * 8 + 1) & 0x7fff);
@@ -2290,6 +2320,8 @@ test_compound_11(void)
((big_t *)buf)[u].i1 = (int)(u * 3);
((big_t *)buf)[u].i2 = (int)(u * 5);
((big_t *)buf)[u].s1 = (char *)HDmalloc((size_t)32);
+ if (!((big_t *)buf)[u].s1)
+ TEST_ERROR
HDsprintf(((big_t *)buf)[u].s1, "%u", (unsigned)u);
} /* end for */
diff --git a/test/file_image.c b/test/file_image.c
index f6075d5..0373468 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -102,8 +102,9 @@ test_properties(void)
* property list functions. In the file driver tests further down, this will
* not be the case.
*/
- size = (size_t)count * sizeof(char);
- buffer = (char *)HDmalloc(size);
+ size = (size_t)count * sizeof(char);
+ if (NULL == (buffer = (char *)HDmalloc(size)))
+ TEST_ERROR
for (i = 0; i < count - 1; i++)
buffer[i] = (char)(65 + i);
buffer[count - 1] = '\0';
@@ -338,8 +339,8 @@ test_callbacks(void)
H5FD_file_image_callbacks_t callbacks;
hid_t fapl_1;
hid_t fapl_2;
- udata_t * udata;
- char * file_image;
+ udata_t * udata = NULL;
+ char * file_image = NULL;
char * temp_file_image;
int count = 10;
int i;
@@ -350,6 +351,7 @@ test_callbacks(void)
/* Allocate and initialize udata */
udata = (udata_t *)HDmalloc(sizeof(udata_t));
+ VERIFY(udata != NULL, "udata malloc failed");
reset_udata(udata);
/* copy the address of the user data into read_callbacks */
@@ -358,6 +360,7 @@ test_callbacks(void)
/* Allocate and initialize file image buffer */
size = (size_t)count * sizeof(char);
file_image = (char *)HDmalloc(size);
+ VERIFY(file_image != NULL, "file_image malloc failed");
for (i = 0; i < count - 1; i++)
file_image[i] = (char)(65 + i);
file_image[count - 1] = '\0';
@@ -529,6 +532,9 @@ test_callbacks(void)
return 0;
error:
+ HDfree(file_image);
+ HDfree(udata);
+
return 1;
} /* test_callbacks() */
diff --git a/test/genall5.c b/test/genall5.c
index a6331f6..1da61f8 100644
--- a/test/genall5.c
+++ b/test/genall5.c
@@ -1673,10 +1673,10 @@ ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data)
failure_mssg = "ds_ctg_i: H5Dwrite() failed.";
}
HDassert(ret >= 0);
-
- HDfree(wdata);
}
+ HDfree(wdata);
+
if (pass) {
ret = H5Dclose(dsid);
@@ -1891,10 +1891,10 @@ vrfy_ds_ctg_i(hid_t fid, const char *dset_name, hbool_t write_data)
}
HDassert((int)u == rdata[u]);
}
-
- HDfree(rdata);
} /* end if */
+ HDfree(rdata);
+
if (pass) {
ret = H5Dclose(dsid);
@@ -2250,10 +2250,10 @@ vrfy_ds_chk_i(hid_t fid, const char *dset_name, hbool_t write_data)
}
HDassert((int)u == rdata[u]);
}
-
- HDfree(rdata);
} /* end if */
+ HDfree(rdata);
+
if (pass) {
ret = H5Dclose(dsid);
@@ -2590,10 +2590,10 @@ vrfy_ds_cpt_i(hid_t fid, const char *dset_name, hbool_t write_data)
}
HDassert((int)u == rdata[u]);
}
-
- HDfree(rdata);
} /* end if */
+ HDfree(rdata);
+
if (pass) {
ret = H5Dclose(dsid);
@@ -2982,10 +2982,10 @@ vrfy_ds_ctg_v(hid_t fid, const char *dset_name, hbool_t write_data)
failure_mssg = "vrfy_ds_ctg_v: H5Treclaim() failed.";
}
HDassert(ret >= 0);
-
- HDfree(rdata);
} /* end if */
+ HDfree(rdata);
+
if (pass) {
ret = H5Sclose(sid);
diff --git a/test/h5test.c b/test/h5test.c
index 2a54982..4dff00d 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -1195,9 +1195,10 @@ h5_set_info_object(void)
valp++;
/* copy key/value pair into temporary buffer */
- len = strcspn(valp, ";");
- next = &valp[len];
- key_val = (char *)HDcalloc(1, len + 1);
+ len = strcspn(valp, ";");
+ next = &valp[len];
+ if (NULL == (key_val = (char *)HDcalloc(1, len + 1)))
+ return -1;
/* increment the next pointer past the terminating semicolon */
if (*next == ';')
@@ -1593,6 +1594,9 @@ h5_make_local_copy(const char *origfilename, const char *local_copy_name)
void * buf = NULL; /* Buffer for copying data */
const char *filename = H5_get_srcdir_filename(origfilename); /* Get the test file name to copy */
+ if (!filename)
+ goto error;
+
/* Allocate copy buffer */
if (NULL == (buf = HDcalloc((size_t)1, (size_t)READ_BUF_SIZE)))
goto error;
diff --git a/test/objcopy.c b/test/objcopy.c
index 43a5756..e01083d 100644
--- a/test/objcopy.c
+++ b/test/objcopy.c
@@ -4498,6 +4498,10 @@ test_copy_dataset_compressed(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid
TESTING("H5Ocopy(): compressed dataset");
#ifndef H5_HAVE_FILTER_DEFLATE
+ (void)fcpl_src;
+ (void)fcpl_dst;
+ (void)src_fapl;
+ (void)dst_fapl; /* Silence compiler */
SKIPPED();
HDputs(" Deflation filter not available");
#else /* H5_HAVE_FILTER_DEFLATE */
@@ -4923,6 +4927,10 @@ test_copy_dataset_no_edge_filt(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, h
}
#ifndef H5_HAVE_FILTER_DEFLATE
+ (void)fcpl_src;
+ (void)fcpl_dst;
+ (void)src_fapl;
+ (void)dst_fapl; /* Silence compiler */
SKIPPED();
HDputs(" Deflation filter not available");
#else /* H5_HAVE_FILTER_DEFLATE */
@@ -7277,6 +7285,10 @@ test_copy_dataset_compressed_vl(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl,
TESTING("H5Ocopy(): compressed dataset with VLEN datatype");
#ifndef H5_HAVE_FILTER_DEFLATE
+ (void)fcpl_src;
+ (void)fcpl_dst;
+ (void)src_fapl;
+ (void)dst_fapl; /* Silence compiler */
SKIPPED();
HDputs(" Deflation filter not available");
#else /* H5_HAVE_FILTER_DEFLATE */
diff --git a/test/trefer_deprec.c b/test/trefer_deprec.c
index 24371ef..755df68 100644
--- a/test/trefer_deprec.c
+++ b/test/trefer_deprec.c
@@ -87,8 +87,11 @@ test_reference_params(void)
/* Allocate write & read buffers */
wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ CHECK_PTR(rbuf, "HDmalloc");
tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ CHECK_PTR(tbuf, "HDmalloc");
/* Create file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
@@ -269,8 +272,11 @@ test_reference_obj(void)
/* Allocate write & read buffers */
wbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ CHECK_PTR(wbuf, "HDmalloc");
rbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ CHECK_PTR(rbuf, "HDmalloc");
tbuf = (hobj_ref_t *)HDmalloc(MAX(sizeof(unsigned), sizeof(hobj_ref_t)) * SPACE1_DIM1);
+ CHECK_PTR(tbuf, "HDmalloc");
/* Create file */
fid1 = H5Fcreate(FILE1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT);
diff --git a/test/use_common.c b/test/use_common.c
index 0ea2c83..8f78f3b 100644
--- a/test/use_common.c
+++ b/test/use_common.c
@@ -322,10 +322,12 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
rank = H5Sget_simple_extent_ndims(f_sid);
if (rank != UC_RANK) {
HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank);
+ HDfree(buffer);
return -1;
}
if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) {
HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
+ HDfree(buffer);
return -1;
}
HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", rank, (unsigned long long)(dims[0]),
@@ -334,12 +336,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
if (dims[0] != 0 || dims[1] != memdims[1] || dims[2] != memdims[2]) {
HDfprintf(stderr, "dataset is not empty. Got dims=(%llu,%llu,%llu)\n", (unsigned long long)dims[0],
(unsigned long long)dims[1], (unsigned long long)dims[2]);
+ HDfree(buffer);
return -1;
}
/* setup mem-space for buffer */
if ((m_sid = H5Screate_simple(rank, memdims, NULL)) < 0) {
HDfprintf(stderr, "H5Screate_simple for memory failed\n");
+ HDfree(buffer);
return -1;
}
@@ -360,6 +364,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
if (opts->use_swmr) {
if (H5Odisable_mdc_flushes(dsid) < 0) {
HDfprintf(stderr, "H5Odisable_mdc_flushes failed\n");
+ HDfree(buffer);
return -1;
}
}
@@ -368,12 +373,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
dims[0] = i + 1;
if (H5Dset_extent(dsid, dims) < 0) {
HDfprintf(stderr, "H5Dset_extent failed\n");
+ HDfree(buffer);
return -1;
}
/* Get the dataset's dataspace */
if ((f_sid = H5Dget_space(dsid)) < 0) {
HDfprintf(stderr, "H5Dset_extent failed\n");
+ HDfree(buffer);
return -1;
}
@@ -381,12 +388,14 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
/* Choose the next plane to write */
if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) {
HDfprintf(stderr, "Failed H5Sselect_hyperslab\n");
+ HDfree(buffer);
return -1;
}
/* Write plane to the dataset */
if (H5Dwrite(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0) {
HDfprintf(stderr, "Failed H5Dwrite\n");
+ HDfree(buffer);
return -1;
}
@@ -394,6 +403,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
if (opts->use_swmr) {
if (H5Oenable_mdc_flushes(dsid) < 0) {
HDfprintf(stderr, "H5Oenable_mdc_flushes failed\n");
+ HDfree(buffer);
return -1;
}
}
@@ -401,6 +411,7 @@ write_uc_file(hbool_t tosend, hid_t file_id, options_t *opts)
/* flush file to make the just written plane available. */
if (H5Dflush(dsid) < 0) {
HDfprintf(stderr, "Failed to H5Fflush file\n");
+ HDfree(buffer);
return -1;
}
} /* end for each plane to write */
@@ -488,10 +499,12 @@ read_uc_file(hbool_t towait, options_t *opts)
rank = H5Sget_simple_extent_ndims(f_sid);
if (rank != UC_RANK) {
HDfprintf(stderr, "rank(%d) of dataset does not match\n", rank);
+ HDfree(buffer);
return -1;
}
if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) {
HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
+ HDfree(buffer);
return -1;
}
HDprintf("dataset rank %d, dimensions %llu x %llu x %llu\n", rank, (unsigned long long)(dims[0]),
@@ -502,12 +515,14 @@ read_uc_file(hbool_t towait, options_t *opts)
(unsigned long long)dims[0], (unsigned long long)dims[1], (unsigned long long)dims[2]);
HDfprintf(stderr, "But memdims=(%llu,%llu,%llu)\n", (unsigned long long)memdims[0],
(unsigned long long)memdims[1], (unsigned long long)memdims[2]);
+ HDfree(buffer);
return -1;
}
/* Setup mem-space for buffer */
if ((m_sid = H5Screate_simple(rank, memdims, NULL)) < 0) {
HDfprintf(stderr, "H5Screate_simple for memory failed\n");
+ HDfree(buffer);
return -1;
}
@@ -533,6 +548,7 @@ read_uc_file(hbool_t towait, options_t *opts)
HDprintf(".");
if (loops_waiting_for_plane >= 30) {
HDfprintf(stderr, "waited too long for new plane, quit.\n");
+ HDfree(buffer);
return -1;
}
}
@@ -550,6 +566,7 @@ read_uc_file(hbool_t towait, options_t *opts)
/* Get the dataset's dataspace */
if ((f_sid = H5Dget_space(dsid)) < 0) {
HDfprintf(stderr, "H5Dget_space failed\n");
+ HDfree(buffer);
return -1;
}
@@ -557,12 +574,14 @@ read_uc_file(hbool_t towait, options_t *opts)
/* Choose the next plane to read */
if (H5Sselect_hyperslab(f_sid, H5S_SELECT_SET, start, NULL, count, NULL) < 0) {
HDfprintf(stderr, "H5Sselect_hyperslab failed\n");
+ HDfree(buffer);
return -1;
}
/* Read the plane from the dataset */
if (H5Dread(dsid, UC_DATATYPE, m_sid, f_sid, H5P_DEFAULT, buffer) < 0) {
HDfprintf(stderr, "H5Dread failed\n");
+ HDfree(buffer);
return -1;
}
@@ -594,12 +613,14 @@ read_uc_file(hbool_t towait, options_t *opts)
f_sid = H5Dget_space(dsid); /* Get filespace handle first. */
if (H5Sget_simple_extent_dims(f_sid, dims, NULL) < 0) {
HDfprintf(stderr, "H5Sget_simple_extent_dims got error\n");
+ HDfree(buffer);
return -1;
}
} /* end while (expecting more planes to read) */
if (H5Fclose(fid) < 0) {
HDfprintf(stderr, "H5Fclose failed\n");
+ HDfree(buffer);
return -1;
}
diff --git a/testpar/t_file.c b/testpar/t_file.c
index 8dea120..5348f4f 100644
--- a/testpar/t_file.c
+++ b/testpar/t_file.c
@@ -952,9 +952,8 @@ test_file_properties(void)
void
test_delete(void)
{
- hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
- hid_t fapl_id = H5I_INVALID_HID; /* File access plist */
- hbool_t is_coll;
+ hid_t fid = H5I_INVALID_HID; /* HDF5 file ID */
+ hid_t fapl_id = H5I_INVALID_HID; /* File access plist */
const char *filename = NULL;
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
diff --git a/testpar/t_span_tree.c b/testpar/t_span_tree.c
index 7c2763c..518741d 100644
--- a/testpar/t_span_tree.c
+++ b/testpar/t_span_tree.c
@@ -35,6 +35,8 @@
#include "H5private.h"
#include "testphdf5.h"
+#define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0
+
static void coll_write_test(int chunk_factor);
static void coll_read_test(void);
@@ -1431,8 +1433,7 @@ lower_dim_size_comp_test__verify_data(uint32_t *buf_ptr,
*-------------------------------------------------------------------------
*/
-#define LDSCT_DS_RANK 5
-#define LOWER_DIM_SIZE_COMP_TEST__RUN_TEST__DEBUG 0
+#define LDSCT_DS_RANK 5
static void
lower_dim_size_comp_test__run_test(const int chunk_edge_size, const hbool_t use_collective_io,
diff --git a/tools/src/h5dump/h5dump_xml.c b/tools/src/h5dump/h5dump_xml.c
index 5507dcc..0e881df 100644
--- a/tools/src/h5dump/h5dump_xml.c
+++ b/tools/src/h5dump/h5dump_xml.c
@@ -2365,14 +2365,21 @@ xml_dump_named_datatype(hid_t type, const char *name)
h5tools_context_t ctx; /* print context */
h5tool_format_t * outputformat = &xml_dataformat;
h5tool_format_t string_dataformat;
- char * tmp;
- char * dtxid;
- char * parentxid;
- char * t_tmp;
- char * t_prefix;
- char * t_name;
+ char * tmp = NULL;
+ char * dtxid = NULL;
+ char * parentxid = NULL;
+ char * t_tmp = NULL;
+ char * t_prefix = NULL;
+ char * t_name = NULL;
tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ if (tmp == NULL) {
+ indentation(dump_indent);
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ h5tools_setstatus(EXIT_FAILURE);
+ goto done;
+ }
+
HDstrcpy(tmp, prefix);
HDstrcat(tmp, "/");
HDstrcat(tmp, name);
@@ -2627,6 +2634,13 @@ xml_dump_group(hid_t gid, const char *name)
}
else {
tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ if (tmp == NULL) {
+ indentation(dump_indent);
+ error_msg("internal error (file %s:line %d)\n", __FILE__, __LINE__);
+ h5tools_setstatus(EXIT_FAILURE);
+ return;
+ }
+
HDstrcpy(tmp, prefix);
par = HDstrdup(tmp);
cp = HDstrrchr(par, '/');
@@ -3146,8 +3160,11 @@ xml_print_strs(hid_t did, int source)
}
bp = (char *)buf;
- if (!is_vlstr)
+ if (!is_vlstr) {
onestring = (char *)HDcalloc(tsiz, sizeof(char));
+ if (onestring == NULL)
+ goto error;
+ }
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@@ -3768,6 +3785,14 @@ xml_dump_dataset(hid_t did, const char *name, struct subset_t H5_ATTR_UNUSED *ss
char *pstr = (char *)HDmalloc((size_t)100);
tmp = (char *)HDmalloc(HDstrlen(prefix) + HDstrlen(name) + 2);
+ if (tmp == NULL) {
+ error_msg("buffer allocation failed\n");
+ h5tools_setstatus(EXIT_FAILURE);
+ HDfree(rstr);
+ HDfree(pstr);
+ return;
+ }
+
HDstrcpy(tmp, prefix);
HDstrcat(tmp, "/");
HDstrcat(tmp, name);