From 4b63089bda38776bf4aa20dc97e6db41823a061c Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 31 May 2002 20:14:00 +0000 Subject: Revert my fix from the other day since camel_imap_command_response() 2002-05-31 Jeffrey Stedfast * 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. svn path=/trunk/; revision=17061 --- camel/ChangeLog | 9 +++++++++ camel/providers/imap/camel-imap-command.c | 9 ++++++--- camel/providers/imap/camel-imap-folder.c | 6 +++--- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/camel/ChangeLog b/camel/ChangeLog index 2005945eb9..aa2a0b9826 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,5 +1,14 @@ 2002-05-31 Jeffrey Stedfast + * 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 4309e18ddd..82ddf26ce7 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; + char *respbuf, *untagged; if (camel_imap_store_readline (store, &respbuf, ex) < 0) { CAMEL_IMAP_STORE_UNLOCK (store, command_lock); @@ -312,9 +312,12 @@ camel_imap_command_response (CamelImapStore *store, char **response, /* Read the rest of the response. */ type = CAMEL_IMAP_RESPONSE_UNTAGGED; - respbuf = imap_read_untagged (store, respbuf, ex); - if (!respbuf) + untagged = imap_read_untagged (store, respbuf, ex); + if (!untagged) { type = CAMEL_IMAP_RESPONSE_ERROR; + g_free (respbuf); + respbuf = NULL; + } break; case '+': diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c index e798dcbebf..156111083a 100644 --- a/camel/providers/imap/camel-imap-folder.c +++ b/camel/providers/imap/camel-imap-folder.c @@ -513,9 +513,6 @@ imap_rescan (CamelFolder *folder, int exists, CamelException *ex) g_datalist_clear (&data); } - /* Free the final tagged response */ - g_free (resp); - camel_operation_end (NULL); if (type == CAMEL_IMAP_RESPONSE_ERROR) { for (i = 0; i < summary_len && new[i].uid; i++) @@ -524,6 +521,9 @@ imap_rescan (CamelFolder *folder, int exists, CamelException *ex) return; } + /* Free the final tagged response */ + g_free (resp); + /* If we find a UID in the summary that doesn't correspond to * the UID in the folder, then either: (a) it's a real UID, * but the message was deleted on the server, or (b) it's a -- cgit v1.2.3