]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
minor memory leak/cleanup fixes
authorTimo Sirainen <tss@iki.fi>
Thu, 10 Apr 2003 22:37:25 +0000 (01:37 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 10 Apr 2003 22:37:25 +0000 (01:37 +0300)
--HG--
branch : HEAD

src/imap/main.c
src/lib-storage/mail-storage.c
src/lib-storage/mail-storage.h
src/lib/ioloop.c
src/pop3/main.c

index f2a7c03183851d181d45404d616dfd1f6a6d0381..68b6dbb2161f6d1916ba0dee2f99c2d8de1312ad 100644 (file)
@@ -143,6 +143,7 @@ static void main_deinit(void)
                i_warning("Killed with signal %d", lib_signal_kill);
 
        clients_deinit();
+        mail_storage_deinit();
 
        closelog();
 }
index 87f261e01665239ee91d9402358f116044e41bda..25da04fa10799e5be45a92884f5d061afb1463be 100644 (file)
@@ -59,6 +59,18 @@ void mail_storage_init(void)
        }
 }
 
+void mail_storage_deinit(void)
+{
+       struct mail_storage_list *next;
+
+       while (storages != NULL) {
+               next = storages->next;
+
+               i_free(storages);
+                storages = next;
+       }
+}
+
 void mail_storage_class_register(struct mail_storage *storage_class)
 {
        struct mail_storage_list *list, **pos;
@@ -160,8 +172,7 @@ void mail_storage_destroy(struct mail_storage *storage)
 {
        i_assert(storage != NULL);
 
-       i_free(storage->dir);
-       i_free(storage);
+       storage->free(storage);
 }
 
 void mail_storage_clear_error(struct mail_storage *storage)
@@ -212,6 +223,7 @@ void mail_storage_set_internal_error(struct mail_storage *storage)
 
        tm = localtime(&ioloop_time);
 
+       i_free(storage->error);
        storage->error = strftime(str, sizeof(str), CRITICAL_MSG, tm) > 0 ?
                i_strdup(str) : i_strdup("Internal error");
        storage->syntax_error = FALSE;
index 93e8c92d725355a33c27adaeb88abc43648b7ff7..e82596e2a70048a20c10c3181de005565f0690b1 100644 (file)
@@ -428,8 +428,8 @@ struct mail_storage_callbacks {
 extern enum client_workarounds client_workarounds;
 extern int full_filesystem_access;
 
-/* Initialize mail storage. */
 void mail_storage_init(void);
+void mail_storage_deinit(void);
 
 /* register all mail storages */
 void mail_storage_register_all(void);
index e8a10cbd88be7624a58fb2eb830effb4441652a5..f17c875e691db72e4e9fdcb5a9ffed4f7d83f990 100644 (file)
@@ -334,6 +334,8 @@ struct ioloop *io_loop_create(pool_t pool)
 
 void io_loop_destroy(struct ioloop *ioloop)
 {
+       pool_t pool;
+
        while (ioloop->ios != NULL) {
                struct io *io = ioloop->ios;
 
@@ -361,5 +363,7 @@ void io_loop_destroy(struct ioloop *ioloop)
         i_assert(ioloop == current_ioloop);
        current_ioloop = current_ioloop->prev;
 
-       pool_unref(ioloop->pool);
+       pool = ioloop->pool;
+       p_free(pool, ioloop);
+       pool_unref(pool);
 }
index 3bd92ae7deccc77202e6e874f10f7dc48bbcf1bc..33123c11a2e341720ec7efc2d2b581849a4ae166 100644 (file)
@@ -110,6 +110,7 @@ static void main_deinit(void)
                i_warning("Killed with signal %d", lib_signal_kill);
 
        clients_deinit();
+        mail_storage_deinit();
 
        closelog();
 }