mirror of
https://github.com/espressif/esp-modbus.git
synced 2025-07-31 10:57:16 +02:00
Merge branch 'bugfix/freemodbus_fix_dereferencing_to_freed_element_issue' into 'master'
Bugfix/freemodbus fix dereferencing to freed element issue Closes IDF-5402 See merge request idf/esp-modbus!24
This commit is contained in:
@ -69,7 +69,7 @@ static void mbc_slave_free_descriptors(void) {
|
|||||||
mb_slave_options_t* mbs_opts = &slave_interface_ptr->opts;
|
mb_slave_options_t* mbs_opts = &slave_interface_ptr->opts;
|
||||||
|
|
||||||
for (int descr_type = 0; descr_type < MB_PARAM_COUNT; descr_type++) {
|
for (int descr_type = 0; descr_type < MB_PARAM_COUNT; descr_type++) {
|
||||||
for (it = LIST_FIRST(&mbs_opts->mbs_area_descriptors[descr_type]); it != NULL; it = LIST_NEXT(it, entries)) {
|
while ((it = LIST_FIRST(&mbs_opts->mbs_area_descriptors[descr_type]))) {
|
||||||
LIST_REMOVE(it, entries);
|
LIST_REMOVE(it, entries);
|
||||||
free(it);
|
free(it);
|
||||||
}
|
}
|
||||||
|
@ -205,6 +205,10 @@ static int xMBTCPPortAcceptConnection(int xListenSockId, char** pcIPAddr)
|
|||||||
inet6_ntoa_r(((struct sockaddr_in6 *)&xSrcAddr)->sin6_addr, cAddrStr, sizeof(cAddrStr) - 1);
|
inet6_ntoa_r(((struct sockaddr_in6 *)&xSrcAddr)->sin6_addr, cAddrStr, sizeof(cAddrStr) - 1);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
else {
|
||||||
|
// Make sure ss_family is valid
|
||||||
|
abort();
|
||||||
|
}
|
||||||
ESP_LOGI(TAG, "Socket (#%d), accept client connection from address: %s", xSockId, cAddrStr);
|
ESP_LOGI(TAG, "Socket (#%d), accept client connection from address: %s", xSockId, cAddrStr);
|
||||||
pcStr = calloc(1, strlen(cAddrStr) + 1);
|
pcStr = calloc(1, strlen(cAddrStr) + 1);
|
||||||
if (pcStr && pcIPAddr) {
|
if (pcStr && pcIPAddr) {
|
||||||
|
@ -429,7 +429,7 @@ static void master_destroy_slave_list(char** table, size_t ip_table_size)
|
|||||||
{
|
{
|
||||||
#if CONFIG_MB_MDNS_IP_RESOLVER
|
#if CONFIG_MB_MDNS_IP_RESOLVER
|
||||||
slave_addr_entry_t *it;
|
slave_addr_entry_t *it;
|
||||||
LIST_FOREACH(it, &slave_addr_list, entries) {
|
while ((it = LIST_FIRST(&slave_addr_list))) {
|
||||||
LIST_REMOVE(it, entries);
|
LIST_REMOVE(it, entries);
|
||||||
free(it);
|
free(it);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user