| Bug #110518 | Memory leak possible | ||
|---|---|---|---|
| Submitted: | 27 Mar 2023 23:53 | Modified: | 23 Dec 2023 13:54 |
| Reporter: | Fangxin Flou (OCA) | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | MySQL Server: Group Replication | Severity: | S3 (Non-critical) |
| Version: | all, 8.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
[28 Mar 2023 7:37]
MySQL Verification Team
Hello Fangxin Flou, Thank you for the report and feedback. Thanks, Umesh
[23 Dec 2023 13:54]
Jon Stephens
Documented fix as follows in the MySQL 8.3.0 changelog:
Removed a possible memory leak in
plugin/group_replication/src/certifier.cc.
Closed.

Description: In the set_certification_info call of certify.cc, we can see the following code: Gtid_set_ref *value = new Gtid_set_ref(certification_info_sid_map, -1); if (value->add_gtid_encoding( reinterpret_cast<const uchar *>(it->second.c_str()), it->second.length()) != RETURN_STATUS_OK) { LogPluginErr(ERROR_LEVEL, ER_GRP_RPL_CANT_READ_WRITE_SET_ITEM, key.c_str()); /* purecov: inspected */ mysql_mutex_unlock(&LOCK_certification_info); /* purecov: inspected */ return 1; /* purecov: inspected */ } value->link(); certification_info.insert( std::pair<std::string, Gtid_set_ref *>(key, value)); Obviously when add_gtid_encoding failed, the memory is not released. How to repeat: N/A Suggested fix: Gtid_set_ref *value = new Gtid_set_ref(certification_info_sid_map, -1); if (value->add_gtid_encoding( reinterpret_cast<const uchar *>(it->second.c_str()), it->second.length()) != RETURN_STATUS_OK) { LogPluginErr(ERROR_LEVEL, ER_GRP_RPL_CANT_READ_WRITE_SET_ITEM, key.c_str()); /* purecov: inspected */ mysql_mutex_unlock(&LOCK_certification_info); /* purecov: inspected */ + delete value; return 1; /* purecov: inspected */ } value->link(); certification_info.insert( std::pair<std::string, Gtid_set_ref *>(key, value));