summaryrefslogtreecommitdiffstats
path: root/src/main.c
diff options
context:
space:
mode:
authorAnton Luka Šijanec <anton@sijanec.eu>2022-04-24 13:24:41 +0200
committerAnton Luka Šijanec <anton@sijanec.eu>2022-04-24 13:24:41 +0200
commitfc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6 (patch)
tree06b2206059672a98ce7797e3e7359f5801e2f0b7 /src/main.c
parentseparated css and html, removed php-cli dependency (diff)
downloadsear.c-fc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6.tar
sear.c-fc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6.tar.gz
sear.c-fc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6.tar.bz2
sear.c-fc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6.tar.lz
sear.c-fc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6.tar.xz
sear.c-fc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6.tar.zst
sear.c-fc50a7f6c9e45b0c4e2bb03fbfc42b70e23b9aa6.zip
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;
}