summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 0b18c0e..e03b0c2 100644
--- a/src/main.c
+++ b/src/main.c
@@ -86,7 +86,7 @@ void sc_signalhander (int s) {
int main (int argc, char ** argv) {
int rs = 0;
struct sc_cache * c = sc_cache_init();
- struct MHD_Daemon * d;
+ struct MHD_Daemon * d = NULL;
if (!c) {
rs = 1;
goto rc;
@@ -103,8 +103,9 @@ int main (int argc, char ** argv) {
fprintf(stderr, "cleaning up!\n");
fflush(stderr);
rc:
+ if (d)
+ MHD_stop_daemon(d); /* stop the daemon and then free, threads might still be run */
xmlCleanupParser();
- MHD_stop_daemon(d); /* stop the daemon first and the free, threads might still be running */
sc_cache_free(c);
return rs;
}