modbus: fix tcp slave destroy issues

Closes https://github.com/espressif/esp-idf/issues/8211
This commit is contained in:
aleks 2022-01-19 12:30:13 +01:00 committed by aleks
parent 9338d1d121
commit 106fcdcc1c
2 changed files with 2 additions and 1 deletions

View File

@ -119,7 +119,7 @@ static esp_err_t mbc_tcp_slave_destroy(void)
(void)vQueueDelete(mbs_opts->mbs_notification_queue_handle);
(void)vEventGroupDelete(mbs_opts->mbs_event_group);
(void)vMBTCPPortClose();
mbs_interface_ptr = NULL;
vMBPortSetMode((UCHAR)MB_PORT_INACTIVE);
return ESP_OK;
}

View File

@ -654,6 +654,7 @@ vMBTCPPortDisable( void )
xConfig.pxMbClientInfo[i] = NULL;
}
}
free(xConfig.pxMbClientInfo);
close(xListenSock);
xListenSock = -1;
vMBTCPPortRespQueueDelete(xConfig.xRespQueueHandle);