diff --git a/pingpongpang.c b/pingpongpang.c
index 980f391f18e3e7d4051282f1b4a70812e8b1b93d..2942799aa05bc786a1b89a9919d584c66ed6dbc3 100644
--- a/pingpongpang.c
+++ b/pingpongpang.c
@@ -16,7 +16,7 @@ int main(int argc, char *argv[])
     printf("Begin \n");
     yield();
     printf("End \n");
-    exit(EXIT_SUCCESS);
+    return EXIT_SUCCESS;
 }
 
 void f_ping(void *args)
diff --git a/try.c b/try.c
index 46c18250f1cc5115921979540562fe5c9c03290c..dc7c6a8fbcc9ba3736fdc8cb0bfbc72e1aaa7f46 100644
--- a/try.c
+++ b/try.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+#include <stdio.h>
 #include <assert.h>
 #include "try.h"
 
@@ -43,6 +44,21 @@ int init_ctx(ctx_t *pctx, int stack_size, funct_t f, void *args)
 
 void switch_to_ctx(ctx_t *pctx)
 {
+
+    if (pctx->status == CTX_END)
+    {
+        // Si c'est l'unique ctx
+        if (pctx == pctx->next_ctx)
+            ring_ctx = NULL;
+        else
+            current_ctx->next_ctx = pctx->next_ctx;
+
+        free(pctx->stack);
+        free(pctx);
+        yield();
+        return;
+    }
+
     assert(pctx->status != CTX_END);
     if (current_ctx != NULL)
     {
@@ -93,7 +109,13 @@ ctx_t *create_ctx(int stack_size, funct_t f, void *args)
 
 void yield()
 {
-    assert(ring_ctx != NULL || current_ctx != NULL);
+    //printf("%p, %p\n", current_ctx, ring_ctx);
+    if (ring_ctx == NULL)
+    {
+        printf("\nEnd \n");
+        exit(EXIT_SUCCESS);
+    }
+
     if (current_ctx == NULL)
         switch_to_ctx(ring_ctx->next_ctx);
     else