Skip to content

Commit 9f4f8a2

Browse files
gkatevj-xiong
authored andcommitted
prov/lnx: Fix ld_core_domains cleanup on init fail
Remove free call for pointer to array element. Check if a core domain is open before closing it in lnx_domain_close(). This can occur if fi_domain() in lnx_open_core_domains() fails. Signed-off-by: George Katevenis <gkatev@ics.forth.gr>
1 parent ea7b49f commit 9f4f8a2

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

prov/lnx/src/lnx_domain.c

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,11 @@ static int lnx_domain_close(struct fid *fid)
7676
for (i = 0; i < domain->ld_num_doms; i++) {
7777
cd = &domain->ld_core_domains[i];
7878

79-
rc = fi_close(&cd->cd_domain->fid);
80-
if (rc)
81-
frc = rc;
79+
if (cd->cd_domain) {
80+
rc = fi_close(&cd->cd_domain->fid);
81+
if (rc)
82+
frc = rc;
83+
}
8284
}
8385

8486
ofi_bufpool_destroy(domain->ld_mem_reg_bp);
@@ -178,10 +180,9 @@ static int lnx_open_core_domains(struct lnx_fabric *lnx_fab,
178180

179181
rc = fi_domain(cf->cf_fabric, cd->cd_info,
180182
&cd->cd_domain, context);
181-
if (rc) {
182-
free(cd);
183+
if (rc)
183184
return rc;
184-
}
185+
185186
cd->cd_fabric = cf;
186187
}
187188
}

0 commit comments

Comments
 (0)