aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNotZed <NotZed@HelixCode.com>2000-05-12 02:39:53 +0800
committerMichael Zucci <zucchi@src.gnome.org>2000-05-12 02:39:53 +0800
commite17b3c90f4a2fc285d83a8badd780b258629b853 (patch)
tree33094dacf028a05a025f5ac1ff7855a64f4e3622
parent62c8174bac8139b29a71ea79c879c4cbdd6cd064 (diff)
downloadgsoc2013-evolution-e17b3c90f4a2fc285d83a8badd780b258629b853.tar.gz
gsoc2013-evolution-e17b3c90f4a2fc285d83a8badd780b258629b853.tar.zst
gsoc2013-evolution-e17b3c90f4a2fc285d83a8badd780b258629b853.zip
Big bunch o memleaks fixed.
2000-05-11 NotZed <NotZed@HelixCode.com> * 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
-rw-r--r--camel/ChangeLog27
-rw-r--r--camel/camel-folder-summary.c2
-rw-r--r--camel/camel-internet-address.c2
-rw-r--r--camel/camel-mime-message.c5
-rw-r--r--camel/camel-mime-part.c1
-rw-r--r--camel/camel-mime-utils.c3
-rw-r--r--camel/providers/mbox/camel-mbox-summary.c32
7 files changed, 60 insertions, 12 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index e615c3917f..5385940204 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,24 @@
+2000-05-11 NotZed <NotZed@HelixCode.com>
+
+ * 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.
+
2000-05-11 <notzed@helixcode.com>
* camel-folder-summary.c (camel_folder_summary_finalise): Free
@@ -123,6 +144,12 @@
* providers/mbox/camel-mbox-summary.c (camel_mbox_summary_update):
Return status.
+ (camel_mbox_summary_expunge): Force an update of the summary
+ before we do anything.
+ (camel_mbox_summary_expunge): Build new xev line in xevnew, and
+ free that, and consify xev.
+ (camel_mbox_summary_load): If we are rebuilding from scratch, make
+ sure we clear the summary content.
* camel-stream-filter.c (do_close): We NEED a stream close.
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 516f9335bd..854017daa9 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -188,6 +188,8 @@ camel_folder_summary_finalise (GtkObject *obj)
g_hash_table_foreach(p->filter_charset, free_o_name, 0);
g_hash_table_destroy(p->filter_charset);
+ g_free(s->summary_path);
+
if (p->filter_index)
gtk_object_unref ((GtkObject *)p->filter_index);
if (p->filter_64)
diff --git a/camel/camel-internet-address.c b/camel/camel-internet-address.c
index fdf790dfd5..003cae5b48 100644
--- a/camel/camel-internet-address.c
+++ b/camel/camel-internet-address.c
@@ -106,7 +106,7 @@ internet_decode (CamelAddress *a, const char *raw)
}
n = n->next;
}
- header_address_unref(ha);
+ header_address_list_clear(&ha);
}
return 0;
}
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index 73d21e7735..7c28949856 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -193,9 +193,12 @@ finalize (GtkObject *object)
g_free (message->subject);
g_free (message->reply_to);
g_free (message->from);
+
+ g_free (message->message_uid);
g_hash_table_foreach (message->recipients, g_lib_is_uber_crappy_shit, NULL);
-
+ g_hash_table_destroy(message->recipients);
+
if (message->user_flags)
g_hash_table_foreach (message->user_flags, free_key_only, NULL);
g_hash_table_destroy(message->user_flags);
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index 279c1139de..af5b5cf6aa 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -532,6 +532,7 @@ write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream,
if (filter) {
filter_stream = camel_stream_filter_new_with_stream(stream);
camel_stream_filter_add(filter_stream, filter);
+ gtk_object_unref((GtkObject *)filter);
stream = (CamelStream *)filter_stream;
}
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 65bbdf32e8..3a2828ff36 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -1276,6 +1276,7 @@ header_decode_addrspec(const char **in)
if (word) {
addr = g_string_append(addr, word);
header_decode_lwsp(&inptr);
+ g_free(word);
while (*inptr == '.' && word) {
inptr++;
addr = g_string_append_c(addr, '.');
@@ -1283,6 +1284,7 @@ header_decode_addrspec(const char **in)
if (word) {
addr = g_string_append(addr, word);
header_decode_lwsp(&inptr);
+ g_free(word);
} else {
w(g_warning("Invalid address spec: %s", *in));
}
@@ -1348,6 +1350,7 @@ header_decode_mailbox(const char **in)
text = header_decode_string(pre);
name = g_string_append(name, text);
g_free(pre);
+ g_free(text);
/* rfc_decode(pre) */
pre = header_decode_word(&inptr);
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 && i<count;i++) {
info = (CamelMboxMessageInfo *)camel_folder_summary_index(s, i);
@@ -591,7 +603,7 @@ camel_mbox_summary_expunge(CamelMboxSummary *mbs)
if (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_FROM_END)
goto error;
- xev = (char *)camel_mime_parser_header(mp, "X-Evolution", (int *)&xevoffset);
+ xev = camel_mime_parser_header(mp, "X-Evolution", (int *)&xevoffset);
if (xev && header_evolution_decode(xev, &uid, &flags) != -1) {
char name[64];
@@ -602,13 +614,13 @@ camel_mbox_summary_expunge(CamelMboxSummary *mbs)
}
xevok = TRUE;
}
- xev = header_evolution_encode(strtoul(info->info.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);