From e17b3c90f4a2fc285d83a8badd780b258629b853 Mon Sep 17 00:00:00 2001 From: NotZed Date: Thu, 11 May 2000 18:39:53 +0000 Subject: Big bunch o memleaks fixed. 2000-05-11 NotZed * camel-mime-part.c (write_to_stream): Unref the filter after adding it to the filtering stream. * providers/mbox/camel-mbox-summary.c (camel_mbox_summary_finalise): Free the folder path. * camel-folder-summary.c (camel_folder_summary_finalise): Free the summary path. * camel-internet-address.c (internet_decode): Free multiple entry addresses properly. * camel-mime-utils.c (header_decode_mailbox): Plugged another memleak, free text after converting it. (header_decode_addrspec): More leaks plugged. * camel-mime-message.c (finalize): Free message_uid. (finalize): Free the recipients hashtable. svn path=/trunk/; revision=2989 --- camel/providers/mbox/camel-mbox-summary.c | 32 +++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) (limited to 'camel/providers/mbox') diff --git a/camel/providers/mbox/camel-mbox-summary.c b/camel/providers/mbox/camel-mbox-summary.c index 1fbbbad075..ead844ee66 100644 --- a/camel/providers/mbox/camel-mbox-summary.c +++ b/camel/providers/mbox/camel-mbox-summary.c @@ -123,6 +123,10 @@ camel_mbox_summary_init (CamelMboxSummary *obj) static void camel_mbox_summary_finalise (GtkObject *obj) { + CamelMboxSummary *mbs = (CamelMboxSummary *)obj; + + g_free(mbs->folder_path); + ((GtkObjectClass *)(camel_mbox_summary_parent))->finalize((GtkObject *)obj); } @@ -341,6 +345,7 @@ camel_mbox_summary_load(CamelMboxSummary *mbs, int forceindex) } if (forceindex || camel_folder_summary_load(s) == -1) { + camel_folder_summary_clear(s); ret = summary_rebuild(mbs, 0); } else { minstart = st.st_size; @@ -508,15 +513,22 @@ camel_mbox_summary_expunge(CamelMboxSummary *mbs) int fd=-1, fdout=-1; off_t offset = 0; char *tmpname=0; - char *buffer, *xev = NULL; + char *buffer, *xevnew = NULL; + const char *xev; int len; guint32 uid, flags; int quick = TRUE, work = FALSE; /* make sure we're in sync */ - /*camel_mbox_summary_load(mbs, FALSE); ? */ - count = camel_folder_summary_count(s); + if (count>0) { + CamelMessageInfo *mi = camel_folder_summary_index(s, count-1); + camel_mbox_summary_update(mbs, mi->content->endpos); + } else { + camel_mbox_summary_update(mbs, 0); + } + + /* check if we have any work to do */ d(printf("Performing expunge, %d messages in inbox\n", count)); for (i=0;quick && iinfo.uid, NULL, 10), info->info.flags); + xevnew = header_evolution_encode(strtoul(info->info.uid, NULL, 10), info->info.flags); if (quick) { if (!xevok) { g_error("The summary told me I had an X-Evolution header, but i dont!"); goto error; } - buffer = g_strdup_printf("X-Evolution: %s", xev); + buffer = g_strdup_printf("X-Evolution: %s", xevnew); do { len = write(fd, buffer, strlen(buffer)); } while (len == -1 && errno == EINTR); @@ -619,7 +631,7 @@ camel_mbox_summary_expunge(CamelMboxSummary *mbs) } else { frompos = lseek(fdout, 0, SEEK_CUR); write(fdout, "From -\n", strlen("From -\n")); - if (header_write(fdout, camel_mime_parser_headers_raw(mp), xev) == -1) { + if (header_write(fdout, camel_mime_parser_headers_raw(mp), xevnew) == -1) { d(printf("Error writing to tmp mailbox\n")); goto error; } @@ -634,8 +646,8 @@ camel_mbox_summary_expunge(CamelMboxSummary *mbs) } info->frompos = frompos; offset = bodypos - info->info.content->bodypos; - } - g_free(xev); xev = NULL; + } + g_free(xevnew); xevnew = NULL; camel_mime_parser_drop_step(mp); camel_mime_parser_drop_step(mp); } else { @@ -690,7 +702,7 @@ error: close(fd); close(fdout); - g_free(xev); + g_free(xevnew); if (tmpname) unlink(tmpname); -- cgit v1.2.3