[Spice-devel] [PATCH spice-server] Make sure statistic file are initialized even if init is not called

Frediano Ziglio fziglio at redhat.com
Thu Nov 17 09:20:18 UTC 2016


This caused a NULL pointer dereference executing some tests
calling spice_server_destroy.

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

This fix a crash in the new spice-codecs-parsing-test test.

diff --git a/server/reds.c b/server/reds.c
index 9a3f06e..dd173d9 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3358,10 +3358,6 @@ static int do_spice_init(RedsState *reds, SpiceCoreInterface *core_interface)
         spice_error("migration timer create failed");
     }
 
-#ifdef RED_STATISTICS
-    reds->stat_file = stat_file_new(REDS_MAX_STAT_NODES);
-#endif
-
     if (reds_init_net(reds) < 0) {
         goto err;
     }
@@ -3437,6 +3433,9 @@ SPICE_GNUC_VISIBLE SpiceServer *spice_server_new(void)
     reds->config->agent_copypaste = TRUE;
     reds->config->agent_file_xfer = TRUE;
     reds->config->exit_on_disconnect = FALSE;
+#ifdef RED_STATISTICS
+    reds->stat_file = stat_file_new(REDS_MAX_STAT_NODES);
+#endif
     return reds;
 }
 
-- 
2.7.4



More information about the Spice-devel mailing list