diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2021-08-25 20:11:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-25 20:11:06 (GMT) |
commit | 6b1adb2ec97a529854613e091270f5b3cb37bc22 (patch) | |
tree | 2779f78bcfad97dcaeff4ef8560ee0c27ef850a1 /test/file_image.c | |
parent | 9424fa2d5e9cab7e187f9e1efe0bc7ba50f691ca (diff) | |
download | hdf5-6b1adb2ec97a529854613e091270f5b3cb37bc22.zip hdf5-6b1adb2ec97a529854613e091270f5b3cb37bc22.tar.gz hdf5-6b1adb2ec97a529854613e091270f5b3cb37bc22.tar.bz2 |
Merge test changes from develop (#959)
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() */ |