[gnome-remote-desktop] hwaccel-nvidia: Don't dereference NULL pointer in assertion



commit 8a68b5d53756ff3a117bdd125a42c2a47beb2efe
Author: Pascal Nowack <Pascal Nowack gmx de>
Date:   Sat Mar 5 11:45:18 2022 +0100

    hwaccel-nvidia: Don't dereference NULL pointer in assertion
    
    Asserting that the hash table with the encode sessions is empty can
    only happen, when the hash table still exists.
    Since the dispose() method can run multiple times, this requires an
    additional check to not run into a crash.
    So, add it.

 src/grd-hwaccel-nvidia.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
---
diff --git a/src/grd-hwaccel-nvidia.c b/src/grd-hwaccel-nvidia.c
index cd9abf66..1efb472a 100644
--- a/src/grd-hwaccel-nvidia.c
+++ b/src/grd-hwaccel-nvidia.c
@@ -882,7 +882,8 @@ grd_hwaccel_nvidia_dispose (GObject *object)
   nvenc_free_functions (&hwaccel_nvidia->nvenc_funcs);
   cuda_free_functions (&hwaccel_nvidia->cuda_funcs);
 
-  g_assert (g_hash_table_size (hwaccel_nvidia->encode_sessions) == 0);
+  g_assert (!hwaccel_nvidia->encode_sessions ||
+            g_hash_table_size (hwaccel_nvidia->encode_sessions) == 0);
   g_clear_pointer (&hwaccel_nvidia->encode_sessions, g_hash_table_destroy);
 
   G_OBJECT_CLASS (grd_hwaccel_nvidia_parent_class)->dispose (object);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]