aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
authorJules Colding <jcolding@src.gnome.org>2007-05-29 17:06:58 +0800
committerJules Colding <jcolding@src.gnome.org>2007-05-29 17:06:58 +0800
commit1118857d92056b587950ea62feec07c4dde63e42 (patch)
tree0533f108b4291e46a7faf91c7df578d1f49c1ace /mail
parentd867b114fa56ed518b41bcdf2e6affe980e0ae10 (diff)
downloadgsoc2013-evolution-1118857d92056b587950ea62feec07c4dde63e42.tar
gsoc2013-evolution-1118857d92056b587950ea62feec07c4dde63e42.tar.gz
gsoc2013-evolution-1118857d92056b587950ea62feec07c4dde63e42.tar.bz2
gsoc2013-evolution-1118857d92056b587950ea62feec07c4dde63e42.tar.lz
gsoc2013-evolution-1118857d92056b587950ea62feec07c4dde63e42.tar.xz
gsoc2013-evolution-1118857d92056b587950ea62feec07c4dde63e42.tar.zst
gsoc2013-evolution-1118857d92056b587950ea62feec07c4dde63e42.zip
Fix file descriptor leaks
svn path=/trunk/; revision=33598
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog12
-rw-r--r--mail/em-utils.c11
-rw-r--r--mail/importers/evolution-outlook-importer.c4
-rw-r--r--mail/importers/mail-importer.c2
-rw-r--r--mail/importers/netscape-importer.c3
5 files changed, 26 insertions, 6 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index e418cb91b8..820fb843c3 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,15 @@
+2007-05-28 Jules Colding <colding@omesc.com>
+
+ * em-utils.c (em_utils_selection_set_urilist): Fix file leak
+ (em_utils_selection_get_urilist): Fix file leak
+
+ * importers/evolution-outlook-importer.c (import_outlook_import): Fix file leak
+
+ * importers/mail-importer.c (import_mbox_import): Impossible code branch commented
+
+ * importers/netscape-importer.c (netscape_import_filters): Fix file leak
+ (netscape_init_prefs): Fix file leak
+
2007-05-28 Srinivasa Ragavan <sragavan@novell.com>
* evolution-mail.schemas.in.in: Make thread expand default to true.
diff --git a/mail/em-utils.c b/mail/em-utils.c
index ab958efc12..e4d53ba12b 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1115,7 +1115,9 @@ em_utils_selection_set_urilist(GtkSelectionData *data, CamelFolder *folder, GPtr
}
camel_object_unref(fstream);
- }
+ } else
+ close(fd);
+
g_free(uri);
}
@@ -1154,8 +1156,11 @@ em_utils_selection_get_urilist(GtkSelectionData *data, CamelFolder *folder)
if (strcmp(url->protocol, "file") == 0
&& (fd = g_open(url->path, O_RDONLY | O_BINARY, 0)) != -1) {
stream = camel_stream_fs_new_with_fd(fd);
- res = em_utils_read_messages_from_stream(folder, stream);
- camel_object_unref(stream);
+ if (stream) {
+ res = em_utils_read_messages_from_stream(folder, stream);
+ camel_object_unref(stream);
+ } else
+ close(fd);
}
camel_url_free(url);
}
diff --git a/mail/importers/evolution-outlook-importer.c b/mail/importers/evolution-outlook-importer.c
index e9f1f64f86..5c63722feb 100644
--- a/mail/importers/evolution-outlook-importer.c
+++ b/mail/importers/evolution-outlook-importer.c
@@ -316,6 +316,7 @@ import_outlook_import(struct _mail_msg *mm)
struct _import_outlook_msg *m = (struct _import_outlook_msg *) mm;
struct stat st;
CamelFolder *folder;
+ int fd = -1;
if (stat(m->path, &st) == -1) {
g_warning("cannot find source file to import '%s': %s", m->path, g_strerror(errno));
@@ -334,7 +335,6 @@ import_outlook_import(struct _mail_msg *mm)
CamelOperation *oldcancel = NULL;
CamelMessageInfo *info;
GByteArray *buffer;
- int fd;
off_t pos;
fd = g_open(m->path, O_RDONLY|O_BINARY, 0);
@@ -413,6 +413,8 @@ import_outlook_import(struct _mail_msg *mm)
g_byte_array_free(buffer, TRUE);
}
fail:
+ if (fd != -1)
+ close(fd);
camel_object_unref(folder);
}
diff --git a/mail/importers/mail-importer.c b/mail/importers/mail-importer.c
index df50c68dfb..8ad5ddef01 100644
--- a/mail/importers/mail-importer.c
+++ b/mail/importers/mail-importer.c
@@ -223,7 +223,7 @@ import_mbox_import(struct _mail_msg *mm)
mp = camel_mime_parser_new();
camel_mime_parser_scan_from(mp, TRUE);
- if (camel_mime_parser_init_with_fd(mp, fd) == -1) {
+ if (camel_mime_parser_init_with_fd(mp, fd) == -1) { /* will never happen - 0 is unconditionally returned */
goto fail2;
}
diff --git a/mail/importers/netscape-importer.c b/mail/importers/netscape-importer.c
index 5bd1377d5c..52f2f7568d 100644
--- a/mail/importers/netscape-importer.c
+++ b/mail/importers/netscape-importer.c
@@ -1238,7 +1238,7 @@ netscape_import_filters (NsImporter *importer)
exit:
g_free(user);
g_object_unref((fc));
-
+ fclose (mailrule_handle);
}
/* Email folder & accounts stuff ----------------------------------------------- */
@@ -1444,6 +1444,7 @@ netscape_init_prefs (void)
g_hash_table_insert (user_prefs, key, value);
}
+ fclose (prefs_handle);
return;
}