Skip to content

Commit 4c9e38e

Browse files
authored
Merge pull request #2077 from hjelmn/tcp_fix
btl/tcp: fix double list remove
2 parents 4159fee + a681837 commit 4c9e38e

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

opal/mca/btl/tcp/btl_tcp_component.c

+2-3
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,7 @@ static int mca_btl_tcp_component_open(void)
394394

395395
static int mca_btl_tcp_component_close(void)
396396
{
397-
opal_list_item_t *item;
397+
mca_btl_tcp_event_t *event, *next;
398398

399399
#if MCA_BTL_TCP_SUPPORT_PROGRESS_THREAD
400400
/**
@@ -454,8 +454,7 @@ static int mca_btl_tcp_component_close(void)
454454

455455
/* remove all pending events. Do not lock the tcp_events list as
456456
the event themselves will unregister during the destructor. */
457-
while( NULL != (item = opal_list_remove_first(&mca_btl_tcp_component.tcp_events)) ) {
458-
mca_btl_tcp_event_t* event = (mca_btl_tcp_event_t*)item;
457+
OPAL_LIST_FOREACH_SAFE(event, next, &mca_btl_tcp_component.tcp_events, mca_btl_tcp_event_t) {
459458
opal_event_del(&event->event);
460459
OBJ_RELEASE(event);
461460
}

0 commit comments

Comments
 (0)