[Spice-devel] [PATCH spice-server] reds: Free remaining configuration

Frediano Ziglio fziglio at redhat.com
Wed Mar 1 09:57:29 UTC 2017


Free security, migration, sasl and name stuff.

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

diff --git a/server/reds.c b/server/reds.c
index 898be92..eabb63f 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3640,6 +3640,24 @@ SPICE_GNUC_VISIBLE int spice_server_init(SpiceServer *reds, SpiceCoreInterface *
     return ret;
 }
 
+static void reds_config_free(SpiceServer *reds)
+{
+    reds_mig_release(reds);
+    ChannelSecurityOptions *now = reds->config->channels_security, *next;
+    for (; now; now = next) {
+        next = now->next;
+        free(now);
+    }
+#if HAVE_SASL
+    free(reds->config->sasl_appname);
+#endif
+    free(reds->config->spice_name);
+    g_array_unref(reds->config->renderers);
+    g_array_unref(reds->config->video_codecs);
+    free(reds->config);
+    reds->config = NULL;
+}
+
 SPICE_GNUC_VISIBLE void spice_server_destroy(SpiceServer *reds)
 {
     /* remove the server from the list of servers so that we don't attempt to
@@ -3668,10 +3686,7 @@ SPICE_GNUC_VISIBLE void spice_server_destroy(SpiceServer *reds)
     stat_file_free(reds->stat_file);
 #endif
 
-    g_array_unref(reds->config->renderers);
-    g_array_unref(reds->config->video_codecs);
-    free(reds->config);
-
+    reds_config_free(reds);
     free(reds);
 }
 
-- 
2.9.3



More information about the Spice-devel mailing list