mirror of
https://github.com/espressif/esp-modbus.git
synced 2025-07-29 18:07:17 +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;
|
||||
|
||||
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);
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
else {
|
||||
// Make sure ss_family is valid
|
||||
abort();
|
||||
}
|
||||
ESP_LOGI(TAG, "Socket (#%d), accept client connection from address: %s", xSockId, cAddrStr);
|
||||
pcStr = calloc(1, strlen(cAddrStr) + 1);
|
||||
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
|
||||
slave_addr_entry_t *it;
|
||||
LIST_FOREACH(it, &slave_addr_list, entries) {
|
||||
while ((it = LIST_FIRST(&slave_addr_list))) {
|
||||
LIST_REMOVE(it, entries);
|
||||
free(it);
|
||||
}
|
||||
|
Reference in New Issue
Block a user