[dovecot-cvs] dovecot/src/lib-storage/index index-search.c, 1.131, 1.132
tss at dovecot.org
tss at dovecot.org
Wed Apr 4 13:28:39 EEST 2007
Update of /var/lib/cvs/dovecot/src/lib-storage/index
In directory talvi:/tmp/cvs-serv27309
Modified Files:
index-search.c
Log Message:
memory leak fixes
Index: index-search.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/index-search.c,v
retrieving revision 1.131
retrieving revision 1.132
diff -u -d -r1.131 -r1.132
--- index-search.c 4 Apr 2007 10:16:38 -0000 1.131
+++ index-search.c 4 Apr 2007 10:28:37 -0000 1.132
@@ -332,9 +332,10 @@
ret = message_search_init(ctx->search_pool, arg->value.str,
ctx->mail_ctx.charset, flags,
&arg_ctx);
- if (ret > 0)
+ if (ret > 0) {
+ arg->context = arg_ctx;
return arg_ctx;
-
+ }
if (ret == 0)
ctx->error = TXT_UNKNOWN_CHARSET;
else
@@ -905,6 +906,17 @@
return &ctx->mail_ctx;
}
+static void search_arg_deinit(struct mail_search_arg *arg,
+ void *context __attr_unused__)
+{
+ struct message_search_context *search_ctx = arg->context;
+
+ if (search_ctx != NULL) {
+ message_search_deinit(&search_ctx);
+ arg->context = NULL;
+ }
+}
+
int index_storage_search_deinit(struct mail_search_context *_ctx)
{
struct index_search_context *ctx = (struct index_search_context *)_ctx;
@@ -917,6 +929,10 @@
"%s", ctx->error);
}
+ mail_search_args_reset(ctx->mail_ctx.args, FALSE);
+ (void)mail_search_args_foreach(ctx->mail_ctx.args,
+ search_arg_deinit, NULL);
+
if (ctx->search_pool != NULL)
pool_unref(ctx->search_pool);
More information about the dovecot-cvs
mailing list