aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2002-06-01 04:43:05 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2002-06-01 04:43:05 +0800
commitb2cae6f3176e10b891a35ce8146ab4f88feec8b1 (patch)
treef8f66893e130dbe0d9579a4443049dea63888772
parentc0836df7ef28cff8195ba4592b9a02e82436df3b (diff)
downloadgsoc2013-evolution-b2cae6f3176e10b891a35ce8146ab4f88feec8b1.tar.gz
gsoc2013-evolution-b2cae6f3176e10b891a35ce8146ab4f88feec8b1.tar.zst
gsoc2013-evolution-b2cae6f3176e10b891a35ce8146ab4f88feec8b1.zip
If we fail to read a literal, free the temporary string buffer.
2002-05-31 Jeffrey Stedfast <fejj@ximian.com> * 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
-rw-r--r--camel/ChangeLog8
-rw-r--r--camel/providers/imap/camel-imap-command.c11
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 <fejj@ximian.com>
+ * 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';