From b2cae6f3176e10b891a35ce8146ab4f88feec8b1 Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 31 May 2002 20:43:05 +0000 Subject: If we fail to read a literal, free the temporary string buffer. 2002-05-31 Jeffrey Stedfast * providers/imap/camel-imap-command.c (imap_read_untagged): If we fail to read a literal, free the temporary string buffer. svn path=/trunk/; revision=17063 --- camel/providers/imap/camel-imap-command.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'camel/providers') diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c index 82ddf26ce7..49e23a944f 100644 --- a/camel/providers/imap/camel-imap-command.c +++ b/camel/providers/imap/camel-imap-command.c @@ -288,7 +288,7 @@ camel_imap_command_response (CamelImapStore *store, char **response, CamelException *ex) { CamelImapResponseType type; - char *respbuf, *untagged; + char *respbuf; if (camel_imap_store_readline (store, &respbuf, ex) < 0) { CAMEL_IMAP_STORE_UNLOCK (store, command_lock); @@ -312,12 +312,9 @@ camel_imap_command_response (CamelImapStore *store, char **response, /* Read the rest of the response. */ type = CAMEL_IMAP_RESPONSE_UNTAGGED; - untagged = imap_read_untagged (store, respbuf, ex); - if (!untagged) { + respbuf = imap_read_untagged (store, respbuf, ex); + if (!respbuf) type = CAMEL_IMAP_RESPONSE_ERROR; - g_free (respbuf); - respbuf = NULL; - } break; case '+': @@ -442,12 +439,14 @@ imap_read_untagged (CamelImapStore *store, char *line, CamelException *ex) else camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, g_strerror (errno)); camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL); + g_string_free (str, TRUE); goto lose; } if (nread < length) { camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, _("Server response ended too soon.")); camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL); + g_string_free (str, TRUE); goto lose; } str->str[length + 1] = '\0'; -- cgit v1.2.3