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/ChangeLog | 8 +++----- camel/providers/imap/camel-imap-command.c | 11 +++++------ 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index aa2a0b9826..b2ee747f69 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,14 +1,12 @@ 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. + * providers/imap/camel-imap-folder.c (imap_rescan): Revert my fix from the other day since camel_imap_command_response() doesn't guarentee that resp will be set to NULL on error. - * providers/imap/camel-imap-command.c - (camel_imap_command_response): Use a different variable to get the - return of imap_parse_untagged so that we don't lose the pointer to - the original malloc'd respbuf buffer. - * camel-data-cache.c (camel_data_cache_get): If we fail to be able to create a stream to insert into the cache, then free the 'real' path. 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