RTPS: Don't leak in the guid hash

If hashing a newly created GBytes, unref the GBytes after computing
the hash (and before returning it.)

Fix #19558 (in combination with 45b929a1b6
and 6f17dcd67d)
This commit is contained in:
John Thacker 2024-01-03 19:56:19 -05:00
parent dd7df70be8
commit ca02798714
1 changed files with 3 additions and 1 deletions

View File

@ -6496,7 +6496,9 @@ static guint hash_by_participant_guid(gconstpointer key) {
const endpoint_guid* guid = (const endpoint_guid*)key;
gint vals[] = { guid->host_id, guid->app_id, guid->instance_id };
GBytes* gbytes = g_bytes_new(vals, sizeof(vals));
return g_bytes_hash(gbytes);
guint hash = g_bytes_hash(gbytes);
g_bytes_unref(gbytes);
return hash;
}
static guint hash_by_guid(gconstpointer key) {