Skip to content

Commit 5cbfddb

Browse files
committed
pmix3x: fix misc memory leaks
(back-ported from upstream commit openpmix/openpmix@1eff526)
1 parent b4e4e4a commit 5cbfddb

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

opal/mca/pmix/pmix3x/pmix/src/client/pmix_client.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ static void job_data(struct pmix_peer_t *pr, pmix_usock_hdr_t *hdr,
188188
cb->active = false;
189189
return;
190190
}
191+
assert(NULL != nspace);
192+
free(nspace);
191193
/* decode it */
192194
pmix_client_process_nspace_blob(pmix_globals.myid.nspace, buf);
193195
cb->status = PMIX_SUCCESS;
@@ -1120,7 +1122,6 @@ void pmix_client_process_nspace_blob(const char *nspace, pmix_buffer_t *bptr)
11201122
bo = &(kptr->value->data.bo);
11211123
PMIX_CONSTRUCT(&buf2, pmix_buffer_t);
11221124
PMIX_LOAD_BUFFER(&buf2, bo->bytes, bo->size);
1123-
PMIX_RELEASE(kptr);
11241125
/* start by unpacking the rank */
11251126
cnt = 1;
11261127
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(&buf2, &rank, &cnt, PMIX_PROC_RANK))) {
@@ -1156,7 +1157,6 @@ void pmix_client_process_nspace_blob(const char *nspace, pmix_buffer_t *bptr)
11561157
bo = &(kptr->value->data.bo);
11571158
PMIX_CONSTRUCT(&buf2, pmix_buffer_t);
11581159
PMIX_LOAD_BUFFER(&buf2, bo->bytes, bo->size);
1159-
PMIX_RELEASE(kptr);
11601160
/* start by unpacking the number of nodes */
11611161
cnt = 1;
11621162
if (PMIX_SUCCESS != (rc = pmix_bfrop.unpack(&buf2, &nnodes, &cnt, PMIX_SIZE))) {
@@ -1225,11 +1225,8 @@ void pmix_client_process_nspace_blob(const char *nspace, pmix_buffer_t *bptr)
12251225
if (PMIX_SUCCESS != (rc = pmix_hash_store(&nsptr->internal, PMIX_RANK_WILDCARD, kptr))) {
12261226
PMIX_ERROR_LOG(rc);
12271227
}
1228-
/* maintain accounting - but note that the kptr remains
1229-
* alive and stored in the hash table! So we cannot reuse
1230-
* it for some other purpose */
1231-
PMIX_RELEASE(kptr);
12321228
}
1229+
PMIX_RELEASE(kptr);
12331230
kptr = PMIX_NEW(pmix_kval_t);
12341231
cnt = 1;
12351232
}

opal/mca/pmix/pmix3x/pmix/src/event/pmix_event_registration.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,7 @@ static void reg_event_hdlr(int sd, short args, void *cbdata)
337337
}
338338
if (PMIX_ERR_WOULD_BLOCK == rc) {
339339
/* the callback will provide our response */
340+
PMIX_RELEASE(cd);
340341
return;
341342
}
342343
goto ack;
@@ -366,6 +367,7 @@ static void reg_event_hdlr(int sd, short args, void *cbdata)
366367
}
367368
if (PMIX_ERR_WOULD_BLOCK == rc) {
368369
/* the callback will provide our response */
370+
PMIX_RELEASE(cd);
369371
return;
370372
}
371373
goto ack;
@@ -395,7 +397,8 @@ static void reg_event_hdlr(int sd, short args, void *cbdata)
395397
goto ack;
396398
}
397399
if (PMIX_ERR_WOULD_BLOCK == rc) {
398-
/* the callback will provide our response */
400+
/* the callback will provide our response */
401+
PMIX_RELEASE(cd);
399402
return;
400403
}
401404

0 commit comments

Comments
 (0)