Thanks for excellent work and sharing with community.
Please it sounds there is a little memory leaking in some functions of melsec_mc_bin.c, for example: read_bool_value, read_address_data, write_bool_value, write_address_data in case would like to correct in source code:
Here are some section of code:
///////////////////////////////////////////////////////////////
if (!mc_analysis_address(address, length, &address_data))
{
RELEASE_DATA(in_bytes.data); // Added on 6/14/2024 to avoid memory leak
return MC_ERROR_CODE_PARSE_ADDRESS_FAILED;
}
///////////////////////////////////////////////////////////////
if (!mc_try_send_msg(fd, &cmd))
{
RELEASE_DATA(cmd.data); // Added on 6/14/2024 to avoid memory Leak
return MC_ERROR_CODE_SOCKET_SEND_FAILED;
}
///////////////////////////////////////////////////////////////
if (!mc_try_send_msg(fd, &cmd))
{ RELEASE_DATA(cmd.data); // Added on 6/14/2024 to avoid memory Leak
return MC_ERROR_CODE_SOCKET_SEND_FAILED;
}
RELEASE_DATA(cmd.data); // Added on 6/14/2024 to avoid memory Leak
Thanks for excellent work and sharing with community. Please it sounds there is a little memory leaking in some functions of melsec_mc_bin.c, for example: read_bool_value, read_address_data, write_bool_value, write_address_data in case would like to correct in source code:
Here are some section of code: /////////////////////////////////////////////////////////////// if (!mc_analysis_address(address, length, &address_data)) { RELEASE_DATA(in_bytes.data); // Added on 6/14/2024 to avoid memory leak return MC_ERROR_CODE_PARSE_ADDRESS_FAILED; } /////////////////////////////////////////////////////////////// if (!mc_try_send_msg(fd, &cmd)) { RELEASE_DATA(cmd.data); // Added on 6/14/2024 to avoid memory Leak return MC_ERROR_CODE_SOCKET_SEND_FAILED; } /////////////////////////////////////////////////////////////// if (!mc_try_send_msg(fd, &cmd)) { RELEASE_DATA(cmd.data); // Added on 6/14/2024 to avoid memory Leak return MC_ERROR_CODE_SOCKET_SEND_FAILED; }
///////////////////////////////////////////////////////////////
Thanks