]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
gui: Shutdown scheduler after schedule() returns.
authorAndre Noll <maan@tuebingen.mpg.de>
Tue, 7 Oct 2014 19:50:25 +0000 (19:50 +0000)
committerAndre Noll <maan@tuebingen.mpg.de>
Sun, 8 Feb 2015 14:10:55 +0000 (15:10 +0100)
This makes sure all resources allocated by the scheduler are released.
Since we exit anyway when schedule() returns, this is not a serious
memory leak. The fix helps to identify real leaks though.

gui.c

diff --git a/gui.c b/gui.c
index 370c731cb916ac00749ad6ccdfbdd8138d2c41cb..5d1a1b62596e6fa545579e760dedbac81f6be59a 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -1408,6 +1408,7 @@ __noreturn static void print_help_and_die(void)
 
 static int setup_tasks_and_schedule(void)
 {
 
 static int setup_tasks_and_schedule(void)
 {
+       int ret;
        struct exec_task exec_task = {.task = NULL};
        struct status_task status_task = {.fd = -1};
        struct input_task input_task = {.task = NULL};
        struct exec_task exec_task = {.task = NULL};
        struct status_task status_task = {.fd = -1};
        struct input_task input_task = {.task = NULL};
@@ -1451,7 +1452,9 @@ static int setup_tasks_and_schedule(void)
                .post_select = signal_post_select,
                .context = &signal_task,
        }, &sched);
                .post_select = signal_post_select,
                .context = &signal_task,
        }, &sched);
-       return schedule(&sched);
+       ret = schedule(&sched);
+       sched_shutdown(&sched);
+       return ret;
 }
 
 /**
 }
 
 /**