Skip to content

Commit

Permalink
modbus: fix tcp slave destroy issues
Browse files Browse the repository at this point in the history
  • Loading branch information
aleks committed Jan 19, 2022
1 parent 90ad86e commit b736502
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* SPDX-FileCopyrightText: 2016-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileCopyrightText: 2016-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand Down Expand Up @@ -109,7 +109,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;
}
Expand Down
3 changes: 2 additions & 1 deletion components/freemodbus/tcp_slave/port/port_tcp_slave.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*
* SPDX-License-Identifier: BSD-3-Clause
*
* SPDX-FileContributor: 2016-2021 Espressif Systems (Shanghai) CO LTD
* SPDX-FileContributor: 2016-2022 Espressif Systems (Shanghai) CO LTD
*/
/*
* FreeModbus Libary: ESP32 TCP Port
Expand Down Expand Up @@ -668,6 +668,7 @@ vMBTCPPortDisable( void )
xConfig.pxMbClientInfo[i] = NULL;
}
}
free(xConfig.pxMbClientInfo);
close(xListenSock);
xListenSock = -1;
vMBTCPPortRespQueueDelete(xConfig.xRespQueueHandle);
Expand Down

0 comments on commit b736502

Please sign in to comment.