aboutsummaryrefslogtreecommitdiffstats
path: root/mail/importers
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/importers
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/importers')
-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
3 files changed, 6 insertions, 3 deletions
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;
}