summary refs log tree commit diff
path: root/shared/nm-glib-aux/nm-random-utils.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2021-08-16 09:51:46 +0200
committerMichael Biebl <biebl@debian.org>2021-08-16 09:51:46 +0200
commitbfe522304da217296e2a61040f58e35ec5d6f3f2 (patch)
tree6c4296644fa59cbfe51d9e8aafebddace5ac6b6f /shared/nm-glib-aux/nm-random-utils.c
parent3a56bce6c0ea7ba0fe269520547740783b342e0d (diff)
New upstream version 1.30.6 upstream/1.30.6
Diffstat (limited to 'shared/nm-glib-aux/nm-random-utils.c')
-rw-r--r--shared/nm-glib-aux/nm-random-utils.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/shared/nm-glib-aux/nm-random-utils.c b/shared/nm-glib-aux/nm-random-utils.c
index c95d368d..97272ca3 100644
--- a/shared/nm-glib-aux/nm-random-utils.c
+++ b/shared/nm-glib-aux/nm-random-utils.c
@@ -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;