[Spice-devel] [PATCH spice-server] test-listen: Fix some use after free

Frediano Ziglio fziglio at redhat.com
Tue Mar 13 13:14:35 UTC 2018


Do not dereference thread_data after has been freed.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/tests/test-listen.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/tests/test-listen.c b/server/tests/test-listen.c
index 531bd1bd..c63ee17e 100644
--- a/server/tests/test-listen.c
+++ b/server/tests/test-listen.c
@@ -174,9 +174,9 @@ static gpointer check_magic_thread(gpointer data)
 
     g_object_unref(stream);
     g_object_unref(connectable);
-    g_free(thread_data);
 
     test_event_loop_quit(thread_data->event_loop);
+    g_free(thread_data);
 
     return NULL;
 }
@@ -194,9 +194,9 @@ static gpointer check_no_connect_thread(gpointer data)
     g_clear_error(&error);
 
     g_object_unref(connectable);
-    g_free(thread_data);
 
     test_event_loop_quit(thread_data->event_loop);
+    g_free(thread_data);
 
     return NULL;
 }
-- 
2.14.3



More information about the Spice-devel mailing list