[Spice-devel,spice-server,15/20] Free QXL instances in spice_server_destroy

Submitted by Frediano Ziglio on Nov. 24, 2016, 5:39 p.m.

Details

Message ID 20161124173907.3341-16-fziglio@redhat.com
State Superseded
Headers show
Series "Start cleaning objects on destruction" ( rev: 1 ) in Spice

Not browsing as part of any series.

Commit Message

Frediano Ziglio Nov. 24, 2016, 5:39 p.m.
Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
---
 server/reds.c | 5 +++++
 1 file changed, 5 insertions(+)

Patch hide | download patch | download mbox

diff --git a/server/reds.c b/server/reds.c
index 701aed6..d9af413 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -3599,6 +3599,8 @@  SPICE_GNUC_VISIBLE void spice_server_destroy(SpiceServer *reds)
     servers = g_list_remove(servers, reds);
     pthread_mutex_unlock(&global_reds_lock);
 
+    g_list_free_full(reds->qxl_instances, (GDestroyNotify)red_qxl_destroy);
+
     if (reds->inputs_channel) {
         reds_unregister_channel(reds, RED_CHANNEL(reds->inputs_channel));
         red_channel_destroy(RED_CHANNEL(reds->inputs_channel));
@@ -3609,6 +3611,9 @@  SPICE_GNUC_VISIBLE void spice_server_destroy(SpiceServer *reds)
     if (reds->mig_timer) {
         reds_core_timer_remove(reds, reds->mig_timer);
     }
+
+    g_object_unref(reds->main_dispatcher);
+
     reds_cleanup(reds);
 #ifdef RED_STATISTICS
     stat_file_free(reds->stat_file);

Comments

make check fails since this one. The reason is that reds-
>main_dispatcher can be NULL in case do_spice_init() wasn't called.

Pavel

On Thu, 2016-11-24 at 17:39 +0000, Frediano Ziglio wrote:
> Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
> ---
>  server/reds.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/server/reds.c b/server/reds.c
> index 701aed6..d9af413 100644
> --- a/server/reds.c
> +++ b/server/reds.c
> @@ -3599,6 +3599,8 @@ SPICE_GNUC_VISIBLE void
> spice_server_destroy(SpiceServer *reds)
>      servers = g_list_remove(servers, reds);
>      pthread_mutex_unlock(&global_reds_lock);
>  
> +    g_list_free_full(reds->qxl_instances,
> (GDestroyNotify)red_qxl_destroy);
> +
>      if (reds->inputs_channel) {
>          reds_unregister_channel(reds, RED_CHANNEL(reds-
> >inputs_channel));
>          red_channel_destroy(RED_CHANNEL(reds->inputs_channel));
> @@ -3609,6 +3611,9 @@ SPICE_GNUC_VISIBLE void
> spice_server_destroy(SpiceServer *reds)
>      if (reds->mig_timer) {
>          reds_core_timer_remove(reds, reds->mig_timer);
>      }
> +
> +    g_object_unref(reds->main_dispatcher);
> +
>      reds_cleanup(reds);
>  #ifdef RED_STATISTICS
>      stat_file_free(reds->stat_file);