mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-30 15:32:37 +08:00
Clean up memory leaks in t_vfd (#4457)
This commit is contained in:
parent
63fcd583d0
commit
e4f079e27b
@ -4216,22 +4216,21 @@ static unsigned
|
||||
vector_write_test_8(int file_name_id, int mpi_rank, int mpi_size, H5FD_mpio_xfer_t xfer_mode,
|
||||
H5FD_mpio_collective_opt_t coll_opt_mode, const char *vfd_name)
|
||||
{
|
||||
const char *fcn_name = "vector_write_test_8()";
|
||||
char test_title[120];
|
||||
char filename[512];
|
||||
haddr_t eoa;
|
||||
haddr_t base_addr;
|
||||
bool show_progress = false;
|
||||
hid_t fapl_id = H5I_INVALID_HID; /* file access property list ID */
|
||||
hid_t dxpl_id = H5I_INVALID_HID; /* data access property list ID */
|
||||
H5FD_t *lf = NULL; /* VFD struct ptr */
|
||||
int cp = 0;
|
||||
int i;
|
||||
int base_index;
|
||||
uint32_t count = 0;
|
||||
size_t sizes[4];
|
||||
H5FD_mem_t types[2];
|
||||
|
||||
const char *fcn_name = "vector_write_test_8()";
|
||||
char test_title[120];
|
||||
char filename[512];
|
||||
haddr_t eoa;
|
||||
haddr_t base_addr;
|
||||
bool show_progress = false;
|
||||
hid_t fapl_id = H5I_INVALID_HID; /* file access property list ID */
|
||||
hid_t dxpl_id = H5I_INVALID_HID; /* data access property list ID */
|
||||
H5FD_t *lf = NULL; /* VFD struct ptr */
|
||||
int cp = 0;
|
||||
int i;
|
||||
int base_index;
|
||||
uint32_t count = 0;
|
||||
size_t sizes[4];
|
||||
H5FD_mem_t types[2];
|
||||
haddr_t *tt_addrs = NULL; /* For storing addrs */
|
||||
const void **tt_bufs = NULL; /* For storing buf pointers */
|
||||
|
||||
@ -4629,6 +4628,9 @@ test_vector_io(int mpi_rank, int mpi_size)
|
||||
H5FD_SUBFILING_NAME);
|
||||
#endif
|
||||
|
||||
/* discard the file image buffers */
|
||||
free_file_images();
|
||||
|
||||
nerrors += (int)nerrs;
|
||||
|
||||
/* return(nerrs);*/
|
||||
@ -5955,15 +5957,14 @@ test_selection_io_types_1d(int mpi_rank, int mpi_size, H5FD_t *lf, hid_t dxpl, H
|
||||
static void
|
||||
test_selection_io_real(int mpi_rank, int mpi_size, H5FD_t *lf, hid_t dxpl)
|
||||
{
|
||||
hid_t mem_spaces[2] = {H5I_INVALID_HID, H5I_INVALID_HID}; /* memory dataspaces vector */
|
||||
hid_t file_spaces[2] = {H5I_INVALID_HID, H5I_INVALID_HID}; /* file dataspaces vector */
|
||||
hsize_t dims1[1]; /* 1d dimension sizes */
|
||||
hsize_t dims2[2]; /* 2d dimension sizes */
|
||||
|
||||
H5FD_mem_t type; /* File type */
|
||||
haddr_t addrs[2]; /* File allocation address */
|
||||
size_t element_sizes[2] = {sizeof(int), sizeof(int)}; /* Element size */
|
||||
size_t bufsize; /* Buffer size */
|
||||
hid_t mem_spaces[2] = {H5I_INVALID_HID, H5I_INVALID_HID}; /* memory dataspaces vector */
|
||||
hid_t file_spaces[2] = {H5I_INVALID_HID, H5I_INVALID_HID}; /* file dataspaces vector */
|
||||
hsize_t dims1[1]; /* 1d dimension sizes */
|
||||
hsize_t dims2[2]; /* 2d dimension sizes */
|
||||
H5FD_mem_t type; /* File type */
|
||||
haddr_t addrs[2]; /* File allocation address */
|
||||
size_t element_sizes[2] = {sizeof(int), sizeof(int)}; /* Element size */
|
||||
size_t bufsize; /* Buffer size */
|
||||
int i;
|
||||
int j;
|
||||
|
||||
@ -6059,18 +6060,30 @@ test_selection_io_real(int mpi_rank, int mpi_size, H5FD_t *lf, hid_t dxpl)
|
||||
}
|
||||
|
||||
/* Free the buffers */
|
||||
if (wbuf1)
|
||||
if (wbuf1) {
|
||||
free(wbuf1);
|
||||
if (wbuf2)
|
||||
wbuf1 = NULL;
|
||||
}
|
||||
if (wbuf2) {
|
||||
free(wbuf2);
|
||||
if (fbuf1)
|
||||
wbuf2 = NULL;
|
||||
}
|
||||
if (fbuf1) {
|
||||
free(fbuf1);
|
||||
if (fbuf2)
|
||||
fbuf1 = NULL;
|
||||
}
|
||||
if (fbuf2) {
|
||||
free(fbuf2);
|
||||
if (erbuf1)
|
||||
fbuf2 = NULL;
|
||||
}
|
||||
if (erbuf1) {
|
||||
free(erbuf1);
|
||||
if (erbuf2)
|
||||
erbuf1 = NULL;
|
||||
}
|
||||
if (erbuf2) {
|
||||
free(erbuf2);
|
||||
erbuf2 = NULL;
|
||||
}
|
||||
|
||||
CHECK_PASSED();
|
||||
|
||||
@ -6085,11 +6098,10 @@ test_selection_io_real(int mpi_rank, int mpi_size, H5FD_t *lf, hid_t dxpl)
|
||||
static void
|
||||
test_selection_io(int mpi_rank, int mpi_size)
|
||||
{
|
||||
H5FD_t *lf = NULL; /* VFD struct ptr */
|
||||
hid_t fapl = H5I_INVALID_HID; /* File access property list */
|
||||
char filename[1024]; /* Test file name */
|
||||
unsigned flags = 0; /* File access flags */
|
||||
|
||||
H5FD_t *lf = NULL; /* VFD struct ptr */
|
||||
hid_t fapl = H5I_INVALID_HID; /* File access property list */
|
||||
char filename[1024]; /* Test file name */
|
||||
unsigned flags = 0; /* File access flags */
|
||||
unsigned collective; /* Types of I/O for testing */
|
||||
hid_t dxpl = H5I_INVALID_HID; /* Dataset transfer property list */
|
||||
hid_t def_dxpl = H5I_INVALID_HID; /* dxpl: independent access */
|
||||
@ -6309,9 +6321,6 @@ finish:
|
||||
printf("===================================\n");
|
||||
}
|
||||
|
||||
/* discard the file image buffers */
|
||||
free_file_images();
|
||||
|
||||
/* close HDF5 library */
|
||||
H5close();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user