dovecot-2.2: imap-urlfetch: Don't leak memory on error. Use TCP ...
dovecot at dovecot.org
dovecot at dovecot.org
Sun May 19 19:51:50 EEST 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/dd0cf0bfdb0c
changeset: 16368:dd0cf0bfdb0c
user: Timo Sirainen <tss at iki.fi>
date: Sun May 19 19:51:34 2013 +0300
description:
imap-urlfetch: Don't leak memory on error. Use TCP corking when sending data.
diffstat:
src/imap/cmd-urlfetch.c | 17 +++++++----------
1 files changed, 7 insertions(+), 10 deletions(-)
diffs (46 lines):
diff -r 1d6f42853492 -r dd0cf0bfdb0c src/imap/cmd-urlfetch.c
--- a/src/imap/cmd-urlfetch.c Wed May 15 17:18:29 2013 +0300
+++ b/src/imap/cmd-urlfetch.c Sun May 19 19:51:34 2013 +0300
@@ -258,20 +258,14 @@
struct cmd_urlfetch_context *ctx = cmd->context;
int ret;
+ o_stream_cork(cmd->client->output);
if (reply == NULL) {
/* fatal failure */
- last = TRUE;
ctx->failed = TRUE;
+ ret = -1;
} else if (reply->succeeded) {
/* URL fetch succeeded */
ret = cmd_urlfetch_url_sucess(cmd, reply);
- if (ret == 0)
- return 0;
- if (ret < 0) {
- ctx->ufetch = NULL;
- cmd_urlfetch_finish(cmd);
- return -1;
- }
} else {
/* URL fetch failed */
string_t *response = t_str_new(128);
@@ -284,14 +278,17 @@
client_send_line(cmd->client, t_strdup_printf(
"* NO %s.", reply->error));
}
+ ret = 1;
}
+ o_stream_uncork(cmd->client->output);
- if (last && cmd->state == CLIENT_COMMAND_STATE_WAIT_EXTERNAL) {
+ if ((last && cmd->state == CLIENT_COMMAND_STATE_WAIT_EXTERNAL) ||
+ ret < 0) {
ctx->ufetch = NULL;
cmd_urlfetch_finish(cmd);
client_command_free(&cmd);
}
- return 1;
+ return ret;
}
static int
More information about the dovecot-cvs
mailing list