[dovecot-cvs] dovecot/src/lib-storage/index/dbox dbox-sync-expunge.c, 1.15.2.2, 1.15.2.3 dbox-uidlist.c, 1.28.2.8, 1.28.2.9

cras at dovecot.org cras at dovecot.org
Sun Jul 23 22:08:59 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-storage/index/dbox
In directory talvi:/tmp/cvs-serv29129

Modified Files:
      Tag: branch_1_0
	dbox-sync-expunge.c dbox-uidlist.c 
Log Message:
Memory/fd leak fixes



Index: dbox-sync-expunge.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-sync-expunge.c,v
retrieving revision 1.15.2.2
retrieving revision 1.15.2.3
diff -u -d -r1.15.2.2 -r1.15.2.3
--- dbox-sync-expunge.c	23 Jul 2006 14:20:29 -0000	1.15.2.2
+++ dbox-sync-expunge.c	23 Jul 2006 19:08:56 -0000	1.15.2.3
@@ -153,12 +153,12 @@
 	dest_entry.file_seq = file_seq;
 
 	/* write file header */
-	t_push();
-	file = t_new(struct dbox_file, 1);
+	file = i_new(struct dbox_file, 1);
+	file->fd = -1;
 	file->output = output;
-	if (dbox_file_write_header(mbox, file) < 0) // FIXME: leaks
+	if (dbox_file_write_header(mbox, file) < 0)
 		ret = -1;
-	t_pop();
+	dbox_file_close(file);
 
 	while (ret > 0) {
 		/* update mail's location in index */

Index: dbox-uidlist.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/dbox/dbox-uidlist.c,v
retrieving revision 1.28.2.8
retrieving revision 1.28.2.9
diff -u -d -r1.28.2.8 -r1.28.2.9
--- dbox-uidlist.c	23 Jul 2006 19:01:02 -0000	1.28.2.8
+++ dbox-uidlist.c	23 Jul 2006 19:08:56 -0000	1.28.2.9
@@ -878,8 +878,10 @@
 
 	/* unlock files */
 	files = array_get(&ctx->files, &count);
-	for (i = 0; i < count; i++)
+	for (i = 0; i < count; i++) {
 		file_dotlock_delete(&files[i]->dotlock);
+		dbox_file_close(files[i]->file);
+	}
 
 	if (ctx->locked)
 		dbox_uidlist_unlock(ctx->uidlist);



More information about the dovecot-cvs mailing list