Skip to content

Commit f722f64

Browse files
author
Jaideep Karande
committed
BUG#36532199: There is a memory leak defect at line 560 in the file /xcom/gcs_xcom_networking
Description: Fixed a memory leak in Gcs_ip_allowlist_entry_hostname::get_value. Previously, the function returned nullptr on error without freeing the allocated memory for a vector. This commit modifies Gcs_ip_allowlist_entry_hostname::get_value to properly delete the vector before returning nullptr in error cases. Change-Id: Iab0076839cccb6c4af7feb3640788ee977f0e9ce
1 parent 678c193 commit f722f64

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

plugin/group_replication/libmysqlgcs/src/bindings/xcom/gcs_xcom_networking.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,10 @@ std::vector<std::pair<std::vector<unsigned char>, std::vector<unsigned char>>>
558558

559559
error = get_address_for_allowlist(ip.second, mask, value);
560560

561-
if (error) return nullptr;
561+
if (error) {
562+
delete retval;
563+
return nullptr;
564+
}
562565

563566
retval->push_back(make_pair(value.first, value.second));
564567
}

0 commit comments

Comments
 (0)