[Spice-devel] [PATCH] Avoid core calling spice_server_destroy

Frediano Ziglio fziglio at redhat.com
Fri Aug 21 02:29:30 PDT 2015


spice_server_destroy calls reds_exit which is called also at exit time
(is registered with atexit) so avoid to keep dandling pointers.

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

diff --git a/server/reds.c b/server/reds.c
index c07cb6c..5d2ad9b 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2700,8 +2700,11 @@ static void reds_exit(void)
         main_channel_close(reds->main_channel);
     }
 #ifdef RED_STATISTICS
-    shm_unlink(reds->stat_shm_name);
-    free(reds->stat_shm_name);
+    if (reds->stat_shm_name) {
+        shm_unlink(reds->stat_shm_name);
+        free(reds->stat_shm_name);
+        reds->stat_shm_name = NULL;
+    }
 #endif
 }
 
-- 
2.4.3



More information about the Spice-devel mailing list