Re: [PATCH] Avoid core calling spice_server_destroy

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Frediano Ziglio <fziglio@xxxxxxxxxx>

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@xxxxxxxxxx>
---
 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
> 
_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]