diff options
author | jhendersonHDF <jhenderson@hdfgroup.org> | 2021-06-16 20:45:26 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-16 20:45:26 (GMT) |
commit | bb7dfbebdcaf3a838d03167a309b9934b997ce92 (patch) | |
tree | abd9e0690ace1a47cc8c6a7e73c49281d38483c3 /test/file_image.c | |
parent | e4e9bb70db3ee275977caad4b494021af41619d7 (diff) | |
download | hdf5-bb7dfbebdcaf3a838d03167a309b9934b997ce92.zip hdf5-bb7dfbebdcaf3a838d03167a309b9934b997ce92.tar.gz hdf5-bb7dfbebdcaf3a838d03167a309b9934b997ce92.tar.bz2 |
Fix several warnings (#747)
Diffstat (limited to 'test/file_image.c')
-rw-r--r-- | test/file_image.c | 14 |
1 files changed, 10 insertions, 4 deletions
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() */ |