[PATCH phodav 05/13] spice: clear loop pointer on unref

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

 



The pointer to loop must be set to NULL on unref.

Quit signal handler can be called at any time,
using g_main_loop_quit() on a freed loop could lead to segfault.

Signed-off-by: Jakub Janků <jjanku@xxxxxxxxxx>
---
 spice/spice-webdavd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/spice/spice-webdavd.c b/spice/spice-webdavd.c
index 6ad63c5..3fac28b 100644
--- a/spice/spice-webdavd.c
+++ b/spice/spice-webdavd.c
@@ -243,7 +243,8 @@ quit (int sig)
   if (sig == SIGINT || sig == SIGTERM)
       quit_service = TRUE;
 
-  g_main_loop_quit (loop);
+  if (loop)
+    g_main_loop_quit (loop);
 }
 
 static Client *
@@ -982,7 +983,7 @@ run_service (ServiceData *service_data)
 
   start_mux_read (mux_istream);
   g_main_loop_run (loop);
-  g_main_loop_unref (loop);
+  g_clear_pointer (&loop, g_main_loop_unref);
 
 #ifdef G_OS_WIN32
   g_cancellable_cancel (map_drive_data.cancel_map);
-- 
2.21.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]