Skip to content

Commit 7841bb2

Browse files
markalleggouaillardet
authored andcommitted
[mpich romio 313289a] romio gpfs: avoid freeing NULL
> Pulled in from mpich romio, branch "main". > Their commit message is below. > > This is part of a batch of commits from the > following set of PRs: > * pmodels/mpich#4943 > -- darray fix which contains a flatten fix > 73a3eba > c4b5762 > * pmodels/mpich#4995 > -- write strided fix > bbb5210 > * pmodels/mpich#5100 > -- build fix for -Wpedantic > ad0e435 > * pmodels/mpich#5099 > -- build fix, they had let file-system=...gpfs bit rot > e1d42af > 313289a > 83bbb82 > * pmodels/mpich#5150 > -- build fix, configure-related _GNU_SOURCE > a712b56 > 5a036e7 > * pmodels/mpich#5184 > -- build fix, continuation of _GNU_SOURCE fix > d97c4ee Configuring mpich with --with-file-system=nfs+ufs+gpfs it wouldn't run because there are a couple free() calls that reported null pointers, so I changed a couple places to "if (x) { ADIOI_Free(x); }" Signed-off-by: Mark Allen <markalle@us.ibm.com>
1 parent c2abd57 commit 7841bb2

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

3rd-party/romio341/adio/ad_gpfs/ad_gpfs_rdcoll.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,8 +425,12 @@ void ADIOI_GPFS_ReadStridedColl(ADIO_File fd, void *buf, int count,
425425
GPFSMPIO_T_CIO_REPORT(0, fd, myrank, nprocs);
426426

427427
/* free all memory allocated for collective I/O */
428-
ADIOI_Free(others_req[0].offsets);
429-
ADIOI_Free(others_req[0].mem_ptrs);
428+
if (others_req[0].offsets) {
429+
ADIOI_Free(others_req[0].offsets);
430+
}
431+
if (others_req[0].mem_ptrs) {
432+
ADIOI_Free(others_req[0].mem_ptrs);
433+
}
430434
ADIOI_Free(others_req);
431435

432436
ADIOI_Free(buf_idx);

3rd-party/romio341/adio/ad_gpfs/ad_gpfs_wrcoll.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,12 @@ void ADIOI_GPFS_WriteStridedColl(ADIO_File fd, const void *buf, int count,
447447
GPFSMPIO_T_CIO_REPORT(1, fd, myrank, nprocs);
448448

449449
/* free all memory allocated for collective I/O */
450-
ADIOI_Free(others_req[0].offsets);
451-
ADIOI_Free(others_req[0].mem_ptrs);
450+
if (others_req[0].offsets) {
451+
ADIOI_Free(others_req[0].offsets);
452+
}
453+
if (others_req[0].mem_ptrs) {
454+
ADIOI_Free(others_req[0].mem_ptrs);
455+
}
452456
ADIOI_Free(others_req);
453457

454458
ADIOI_Free(buf_idx);

0 commit comments

Comments
 (0)