These are the changes to eliminate most of the arbitrary limits in the
[citadel.git] / citadel / citserver.c
index ead5ddc5628709b7dbf43150f580f99cd07118d4..8b3cdaa50a2815255590c4d1a5dc94bedfcb3bf5 100644 (file)
@@ -58,6 +58,9 @@ void master_cleanup() {
 /*
  * Gracefully terminate the session and thread.
  * (This is called as a cleanup handler by the thread library.)
+ *
+ * All NON-system-dependent stuff is done in this function.
+ * System-dependent session/thread cleanup is in cleanup() in sysdep.c
  */
 void cleanup_stuff()
 {
@@ -83,6 +86,9 @@ void cleanup_stuff()
                }
        end_critical_section(S_SESSION_TABLE);
 
+       /* Deallocate any message list we might have in memory */
+       if (CC->msglist != NULL) free(CC->msglist);
+
        /* Now get rid of the session and context */
        lprintf(7, "cleanup_stuff() is calling RemoveContext(%d)\n", CC->cs_pid);
        RemoveContext(CC);
@@ -608,6 +614,8 @@ void *context_loop(struct CitContext *con)
        CC->upload_fp = NULL;
        CC->cs_pid = con->client_socket;        /* not necessarily portable */
        CC->FirstExpressMessage = NULL;
+       CC->msglist = NULL;
+       CC->num_msgs = 0;
        time(&CC->lastcmd);
        time(&CC->lastidle);
        strcpy(CC->lastcmdname, "    ");