glib-aux: fix releasing thead-local GRand instance from nm_utils_random_bytes()

Fixes: b01a453ca2 ('core: add nm_utils_random_bytes() and use getrandom()')
This commit is contained in:
Thomas Haller 2021-06-30 23:19:44 +02:00
parent b433c21ae4
commit c127e1becc
No known key found for this signature in database
GPG key ID: 29C2366E4DFC5728

View file

@ -122,8 +122,10 @@ fd_open:
*/
has_high_quality = FALSE;
if (G_UNLIKELY(!rand))
if (G_UNLIKELY(!rand)) {
rand = g_rand_new();
nm_utils_thread_local_register_destroy(rand, (GDestroyNotify) g_rand_free);
}
nm_assert(n > 0);
i = 0;