[dovecot-cvs] dovecot/src/lib-index mail-custom-flags.c,1.14,1.15 mail-index-update-cache.c,1.10,1.11 mail-index-update.c,1.35,1.36

cras at procontrol.fi cras at procontrol.fi
Sun Dec 1 16:19:09 EET 2002


Update of /home/cvs/dovecot/src/lib-index
In directory danu:/tmp/cvs-serv14279/lib-index

Modified Files:
	mail-custom-flags.c mail-index-update-cache.c 
	mail-index-update.c 
Log Message:
A few memory leak fixes.



Index: mail-custom-flags.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-custom-flags.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- mail-custom-flags.c	25 Nov 2002 19:02:49 -0000	1.14
+++ mail-custom-flags.c	1 Dec 2002 14:19:06 -0000	1.15
@@ -51,6 +51,11 @@
 
 static int update_mmap(MailCustomFlags *mcf)
 {
+	if (mcf->mmap_base != NULL) {
+		if (munmap(mcf->mmap_base, mcf->mmap_length) < 0)
+			index_cf_set_syscall_error(mcf, "munmap()");
+	}
+
 	mcf->mmap_base = mmap_rw_file(mcf->fd, &mcf->mmap_length);
 	if (mcf->mmap_base == MAP_FAILED) {
 		mcf->mmap_base = NULL;

Index: mail-index-update-cache.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-update-cache.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- mail-index-update-cache.c	2 Nov 2002 20:10:20 -0000	1.10
+++ mail-index-update-cache.c	1 Dec 2002 14:19:06 -0000	1.11
@@ -43,8 +43,12 @@
 	rec = index->lookup(index, 1);
 	while (rec != NULL) {
 		if ((rec->data_fields & cache_fields) != cache_fields) {
-			if (!cache_record(index, rec, cache_fields))
+			t_push();
+			if (!cache_record(index, rec, cache_fields)) {
+				t_pop();
 				return FALSE;
+			}
+			t_pop();
 		}
 
 		rec = index->next(index, rec);

Index: mail-index-update.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib-index/mail-index-update.c,v
retrieving revision 1.35
retrieving revision 1.36
diff -u -d -r1.35 -r1.36
--- mail-index-update.c	30 Nov 2002 14:02:24 -0000	1.35
+++ mail-index-update.c	1 Dec 2002 14:19:06 -0000	1.36
@@ -396,10 +396,12 @@
 			ctx->envelope_pool =
 				pool_create("index envelope", 2048, FALSE);
 		}
+		t_push();
 		imap_envelope_parse_header(ctx->envelope_pool,
 					   &ctx->envelope,
 					   t_strndup(name, name_len),
 					   value, value_len);
+		t_pop();
 	}
 
 	if (ctx->header_func != NULL) {




More information about the dovecot-cvs mailing list