[dovecot-cvs] dovecot/src/lib-mail message-body-search.c, 1.20, 1.21 message-header-search.c, 1.12, 1.13

cras at dovecot.org cras at dovecot.org
Mon Dec 20 14:51:20 EET 2004


Update of /var/lib/cvs/dovecot/src/lib-mail
In directory talvi:/tmp/cvs-serv29414/lib-mail

Modified Files:
	message-body-search.c message-header-search.c 
Log Message:
Memory leak fix + crashfixes. Found and fixes by Kazuo Moriwaka



Index: message-body-search.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-body-search.c,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- message-body-search.c	7 Nov 2004 15:21:29 -0000	1.20
+++ message-body-search.c	20 Dec 2004 12:51:18 -0000	1.21
@@ -111,6 +111,10 @@
 						    ctx->body_ctx->key,
 						    ctx->body_ctx->charset,
 						    NULL);
+	if (hdr_search_ctx == NULL) {
+		/* Invalid key. */
+		return FALSE;
+	}
 
 	/* we default to text content-type */
 	ctx->content_type_text = TRUE;
@@ -292,8 +296,7 @@
 	if (ctx->translation == NULL)
 		ctx->translation = charset_to_utf8_begin("ascii", NULL);
 
-	ctx->decode_buf =
-		buffer_create_dynamic(pool_datastack_create(), 256);
+	ctx->decode_buf = buffer_create_dynamic(default_pool, 256);
 	ctx->match_buf = buffer_create_static_hard(pool_datastack_create(),
 						   sizeof(size_t) *
 						   ctx->body_ctx->key_len);
@@ -349,6 +352,7 @@
 
 	if (ctx->translation != NULL)
 		charset_to_utf8_end(ctx->translation);
+	buffer_free(ctx->decode_buf);
 	return found;
 }
 

Index: message-header-search.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-mail/message-header-search.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- message-header-search.c	5 Jan 2003 13:09:52 -0000	1.12
+++ message-header-search.c	20 Dec 2004 12:51:18 -0000	1.13
@@ -48,6 +48,7 @@
 
 	if (key == NULL) {
 		/* invalid key */
+		p_free(pool, ctx);
 		return NULL;
 	}
 



More information about the dovecot-cvs mailing list