diff options
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; } |