[Spice-devel] [PATCH] Free coroutine stack when releasing coroutine
Christophe Fergeau
cfergeau at redhat.com
Mon Nov 18 08:59:25 PST 2013
Hey,
This wasn't pushed yet, but is the cause for
https://bugzilla.redhat.com/show_bug.cgi?id=1028637
I'll push this amended version (with same author/log as the initial
patch) if noone objects:
diff --git a/gtk/coroutine_ucontext.c b/gtk/coroutine_ucontext.c
index f960cfb..3663dfb 100644
--- a/gtk/coroutine_ucontext.c
+++ b/gtk/coroutine_ucontext.c
@@ -25,8 +25,10 @@
#include <sys/types.h>
#endif
#include <sys/mman.h>
+#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "coroutine.h"
#ifndef MAP_ANONYMOUS
@@ -70,7 +72,8 @@ int coroutine_init(struct coroutine *co)
MAP_PRIVATE | MAP_ANONYMOUS,
-1, 0);
if (co->cc.stack == MAP_FAILED)
- return -1;
+ g_error("Failed to allocate %u bytes for coroutine stack:
%s",
+ (unsigned)co->stack_size, strerror(errno));
co->cc.entry = coroutine_trampoline;
co->cc.release = _coroutine_release;
co->exited = 0;
Christophe
On Fri, Sep 13, 2013 at 01:30:18PM +0100, Daniel P. Berrange wrote:
> From: "Daniel P. Berrange" <berrange at redhat.com>
>
> The coroutine_init function mmap's a stack for the
> ucontext coroutine, but nothing ever munmaps it.
>
> Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
> ---
> gtk/coroutine_ucontext.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/gtk/coroutine_ucontext.c b/gtk/coroutine_ucontext.c
> index 79e4afe..f65337e 100644
> --- a/gtk/coroutine_ucontext.c
> +++ b/gtk/coroutine_ucontext.c
> @@ -48,6 +48,8 @@ static int _coroutine_release(struct continuation *cc)
> return ret;
> }
>
> + munmap(co->cc.stack, co->cc.stack_size);
> +
> co->caller = NULL;
>
> return 0;
> --
> 1.8.3.1
>
> _______________________________________________
> Spice-devel mailing list
> Spice-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/spice-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20131118/ef9f469f/attachment.pgp>
More information about the Spice-devel
mailing list