* migrate message creation to templates (citing still missing)
[citadel.git] / webcit / context_loop.c
index 0107e0a38722b7e84f502ba7e4fd6450efedbf33..7b646fbd4e8b8d555265554924d5110d1ff8c0d0 100644 (file)
@@ -22,15 +22,12 @@ pthread_key_t MyConKey;         /**< TSD key for MySession() */
 /*
  * free the memory used for viewing atachments
  */
-void free_attachments(struct wcsession *sess) {
-       struct wc_attachment *att;
-
-       while (sess->first_attachment != NULL) {
-               att = sess->first_attachment;
-               sess->first_attachment = sess->first_attachment->next;
-               free(att->data);
-               free(att);
-       }
+void free_attachment(void *vattach) {
+       wc_attachment *att = (wc_attachment*) vattach;
+       FreeStrBuf(&att->content_type);
+       FreeStrBuf(&att->filename);
+       free(att->data);
+       free(att);
 }
 
 
@@ -44,7 +41,7 @@ void DestroySession(struct wcsession **sessions_to_kill)
        if ((*sessions_to_kill)->cache_fold != NULL) {
                free((*sessions_to_kill)->cache_fold);
        }
-       free_attachments((*sessions_to_kill));
+       DeleteHash(&((*sessions_to_kill)->attachments));
        free_march_list((*sessions_to_kill));
        DeleteHash(&((*sessions_to_kill)->hash_prefs));
        DeleteHash(&((*sessions_to_kill)->IconBarSetttings));