]> code.citadel.org Git - citadel.git/blobdiff - webcit/webserver.c
* several memoryleaks
[citadel.git] / webcit / webserver.c
index 99cdfc2569344c7523fa0e3fa9423e9d83cff818..c8c117450264d9c1441eccd95d4f0ff93b33a5b5 100644 (file)
@@ -242,7 +242,8 @@ int client_read_to(int sock, char *buf, int bytes, int timeout)
  */
 void begin_burst(void)
 {
-       WC->WBuf = NewStrBufPlain(NULL, 32768);
+       if (WC->WBuf == NULL)
+               WC->WBuf = NewStrBufPlain(NULL, 32768);
 }
 
 
@@ -581,8 +582,12 @@ void spawn_another_worker_thread()
        pthread_attr_destroy(&attr);
 }
 
+//#define DBG_PRINNT_HOOKS_AT_START
+#ifdef DBG_PRINNT_HOOKS_AT_START
 const char foobuf[32];
 const char *nix(void *vptr) {snprintf(foobuf, 32, "%0x", (long) vptr); return foobuf;}
+#endif 
+
 /*
  * \brief Here's where it all begins.
  * \param argc number of commandline args
@@ -612,7 +617,10 @@ int main(int argc, char **argv)
 
        HandlerHash = NewHash(1, NULL);
        initialise_modules();
+
+#ifdef DBG_PRINNT_HOOKS_AT_START
        dbg_PrintHash(HandlerHash, nix, NULL);
+#endif
 
        /* Ensure that we are linked to the correct version of libcitadel */
        if (libcitadel_version_number() < LIBCITADEL_VERSION_NUMBER) {
@@ -851,6 +859,7 @@ int main(int argc, char **argv)
        /* now the original thread becomes another worker */
        worker_entry();
        ShutDownLibCitadel ();
+       DeleteHash(&HandlerHash);
        return 0;
 }
 
@@ -926,6 +935,10 @@ void worker_entry(void)
                                icaltimezone_release_zone_tab ();
                                icalmemory_free_ring ();
                                ShutDownLibCitadel ();
+                               DeleteHash(&HandlerHash);
+#ifdef ENABLE_NLS
+                               void ShutdownLocale(void);
+#endif
                                lprintf(2, "master shutdown exiting!.\n");                              
                                exit(0);
                        }