diff options
Diffstat (limited to 'testpar/t_pflush2.c')
-rw-r--r-- | testpar/t_pflush2.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/testpar/t_pflush2.c b/testpar/t_pflush2.c index 8cf40d0..af2e57d 100644 --- a/testpar/t_pflush2.c +++ b/testpar/t_pflush2.c @@ -26,7 +26,7 @@ const char *FILENAME[] = {"flush", "noflush", NULL}; -static int data_g[100][100]; +static int *data_g = NULL; #define N_GROUPS 100 @@ -77,9 +77,10 @@ check_test_file(char *name, size_t name_length, hid_t fapl_id) for (i = 0; i < dims[0]; i++) { for (j = 0; j < dims[1]; j++) { val = (int)(i + (i * j) + j); - if (data_g[i][j] != val) { + if (data_g[(i * 100) + j] != val) { H5_FAILED(); - HDprintf(" data_g[%lu][%lu] = %d\n", (unsigned long)i, (unsigned long)j, data_g[i][j]); + HDprintf(" data_g[%lu][%lu] = %d\n", (unsigned long)i, (unsigned long)j, + data_g[(i * 100) + j]); HDprintf(" should be %d\n", val); } } @@ -170,6 +171,9 @@ main(int argc, char *argv[]) HDexit(EXIT_SUCCESS); } + if (NULL == (data_g = HDmalloc(100 * 100 * sizeof(*data_g)))) + goto error; + if ((fapl_id1 = H5Pcreate(H5P_FILE_ACCESS)) < 0) goto error; if (H5Pset_fapl_mpio(fapl_id1, comm, info) < 0) @@ -213,10 +217,18 @@ main(int argc, char *argv[]) h5_clean_files(&FILENAME[0], fapl_id1); h5_clean_files(&FILENAME[1], fapl_id2); + if (data_g) { + HDfree(data_g); + data_g = NULL; + } + MPI_Finalize(); HDexit(EXIT_SUCCESS); error: + if (data_g) + HDfree(data_g); + HDexit(EXIT_FAILURE); } /* end main() */ |