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

Frediano Ziglio fziglio at redhat.com
Wed Aug 26 07:30:26 PDT 2015


From: Frediano Ziglio <fziglio at redhat.com>

spice_server_destroy calls reds_exit which is called also at exit time
(is registered with atexit) so avoid to keep dangling pointers.
Currently this does not happen as spice_server_destroy is not called
by Qemu.

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

> On Wed, Aug 26, 2015 at 09:54:14AM -0400, Frediano Ziglio wrote:
> > 
> > > 
> > > On Fri, Aug 21, 2015 at 10:29:30AM +0100, Frediano Ziglio wrote:
> > > > spice_server_destroy calls reds_exit which is called also at exit time
> > > > (is registered with atexit) so avoid to keep dandling pointers.
> > > 
> > > s/dandling/dangling/
> > > 
> > > Is this possible to trigger somehow? Looks good to me, ACK.
> > > 
> > > Christophe
> > > 
> > 
> > Yes, just call spice_server_destroy and wait for exit() :)
> 
> Ok, so this currently not happening because we are lucky and no code
> calls spice_server_destroy()? I would mention that in the commit log.
> 
> Christophe
> 


More information about the Spice-devel mailing list