diff src/plugins/trash/trash-plugin.c @ 3879:928229f8b3e6 HEAD

deinit, unref, destroy, close, free, etc. functions now take a pointer to their data pointer, and set it to NULL. This makes double-frees less likely to cause security holes.
author Timo Sirainen <tss@iki.fi>
date Sat, 14 Jan 2006 20:47:20 +0200
parents 55df57c028d4
children 71b8faa84ec6
line wrap: on
line diff
--- a/src/plugins/trash/trash-plugin.c	Sat Jan 14 19:23:22 2006 +0200
+++ b/src/plugins/trash/trash-plugin.c	Sat Jan 14 20:47:20 2006 +0200
@@ -146,23 +146,18 @@
 	for (i = 0; i < count; i++) {
 		struct trash_mailbox *trash = &trashes[i];
 
-		mail_free(trash->mail);
-		trash->mail = NULL;
-
-		(void)mailbox_search_deinit(trash->search_ctx);
-		trash->search_ctx = NULL;
+		mail_free(&trash->mail);
+		(void)mailbox_search_deinit(&trash->search_ctx);
 
 		if (size_needed == 0) {
-			(void)mailbox_transaction_commit(trash->trans,
+			(void)mailbox_transaction_commit(&trash->trans,
 				MAILBOX_SYNC_FLAG_FULL_WRITE);
 		} else {
 			/* couldn't get enough space, don't expunge anything */
-                        mailbox_transaction_rollback(trash->trans);
+                        mailbox_transaction_rollback(&trash->trans);
 		}
-		trash->trans = NULL;
 
-		mailbox_close(trash->box);
-		trash->box = NULL;
+		mailbox_close(&trash->box);
 	}
 	return size_needed == 0;
 }
@@ -265,7 +260,7 @@
 		trash->name = p_strdup(config_pool, name+1);
 		trash->priority = atoi(t_strdup_until(line, name));
 	}
-	i_stream_unref(input);
+	i_stream_unref(&input);
 	(void)close(fd);
 
 	qsort(array_get_modifyable(&trash_boxes, NULL),