mirror of
https://github.com/HDFGroup/hdf5.git
synced 2025-01-30 15:32:37 +08:00
Fixes a small memory leak in the chunk_cache test (#208)
This commit is contained in:
parent
5025d8160f
commit
f3b8fb38de
@ -98,7 +98,7 @@ create_dset1(hid_t file)
|
||||
hid_t dcpl = H5I_INVALID_HID;
|
||||
hsize_t dims[RANK] = {DSET1_DIM1, DSET1_DIM2};
|
||||
hsize_t chunk_dims[RANK] = {CHUNK1_DIM1, CHUNK1_DIM2};
|
||||
int ** data; /* data for writing */
|
||||
int ** data = NULL; /* data for writing */
|
||||
|
||||
/* Create the data space. */
|
||||
if ((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0)
|
||||
@ -134,6 +134,7 @@ create_dset1(hid_t file)
|
||||
H5Dclose(dataset);
|
||||
H5Pclose(dcpl);
|
||||
H5Sclose(dataspace);
|
||||
HDfree(data);
|
||||
return 0;
|
||||
|
||||
error:
|
||||
@ -144,6 +145,7 @@ error:
|
||||
H5Sclose(dataspace);
|
||||
}
|
||||
H5E_END_TRY;
|
||||
HDfree(data);
|
||||
|
||||
return 1;
|
||||
}
|
||||
@ -160,7 +162,7 @@ create_dset2(hid_t file)
|
||||
hid_t dcpl = H5I_INVALID_HID;
|
||||
hsize_t dims[RANK] = {DSET2_DIM1, DSET2_DIM2};
|
||||
hsize_t chunk_dims[RANK] = {CHUNK2_DIM1, CHUNK2_DIM2};
|
||||
int ** data; /* data for writing */
|
||||
int ** data = NULL; /* data for writing */
|
||||
|
||||
/* Create the data space. */
|
||||
if ((dataspace = H5Screate_simple(RANK, dims, NULL)) < 0)
|
||||
@ -195,6 +197,7 @@ create_dset2(hid_t file)
|
||||
H5Dclose(dataset);
|
||||
H5Pclose(dcpl);
|
||||
H5Sclose(dataspace);
|
||||
HDfree(data);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -206,6 +209,7 @@ error:
|
||||
H5Sclose(dataspace);
|
||||
}
|
||||
H5E_END_TRY;
|
||||
HDfree(data);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user