src/server/safs/common.c

changeset 573
76ccfc2a932f
parent 551
97039494764b
child 579
e10457d74fe1
--- a/src/server/safs/common.c	Thu Jan 30 18:19:12 2025 +0100
+++ b/src/server/safs/common.c	Thu Jan 30 18:29:30 2025 +0100
@@ -74,6 +74,10 @@
 #define COMMONSAF_REQ_ABORTED -1
 #define COMMONSAF_RET_ERROR -2
 
+static void common_saf_cleanup(void *d) {
+    cxMapDestroy(var_names);
+}
+
 void common_saf_init() {
     var_names = cxHashMapCreate(cxDefaultAllocator, CX_STORE_POINTERS, 32);
     
@@ -104,6 +108,8 @@
     cxMapPut(var_names, cx_hash_key_str("http-upgrade"), (void*)(intptr_t)COMMONSAF_HTTP_UPGRADE);
     cxMapPut(var_names, cx_hash_key_str("keep-alive"), (void*)(intptr_t)COMMONSAF_KEEP_ALIVE);
     cxMapPut(var_names, cx_hash_key_str("name"), (void*)(intptr_t)COMMONSAF_NAME);
+    
+    webserver_atrestart(common_saf_cleanup, NULL);
 }
 
 int print_message(pblock *pb, Session *sn, Request *rq) {

mercurial