diff options
author | Milan Crha <mcrha@redhat.com> | 2012-01-09 21:27:53 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2012-01-09 21:27:53 +0800 |
commit | df77623924aaa03cba0e861ddf840de1f2b8f28a (patch) | |
tree | f951700d8e6ddd5c15012a618b6580e3ded884dd /mail | |
parent | d690aaea2687f9cc32571accb65a60e6b390acd9 (diff) | |
download | gsoc2013-evolution-df77623924aaa03cba0e861ddf840de1f2b8f28a.tar gsoc2013-evolution-df77623924aaa03cba0e861ddf840de1f2b8f28a.tar.gz gsoc2013-evolution-df77623924aaa03cba0e861ddf840de1f2b8f28a.tar.bz2 gsoc2013-evolution-df77623924aaa03cba0e861ddf840de1f2b8f28a.tar.lz gsoc2013-evolution-df77623924aaa03cba0e861ddf840de1f2b8f28a.tar.xz gsoc2013-evolution-df77623924aaa03cba0e861ddf840de1f2b8f28a.tar.zst gsoc2013-evolution-df77623924aaa03cba0e861ddf840de1f2b8f28a.zip |
Bug #667528 - Crash in pine-importer.c with no book source defined
Diffstat (limited to 'mail')
-rw-r--r-- | mail/importers/pine-importer.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/mail/importers/pine-importer.c b/mail/importers/pine-importer.c index 55522d34d7..1ba44583ab 100644 --- a/mail/importers/pine-importer.c +++ b/mail/importers/pine-importer.c @@ -177,7 +177,7 @@ static void import_contacts (void) { ESource *source; - ESourceList *source_list; + ESourceList *source_list = NULL; EBookClient *book_client; gchar *name; GString *line; @@ -200,10 +200,19 @@ import_contacts (void) name = g_build_filename(g_get_home_dir(), ".addressbook", NULL); fp = fopen(name, "r"); g_free (name); - if (fp == NULL) + if (fp == NULL) { + g_object_unref (source_list); return; + } source = e_source_list_peek_source_any (source_list); + if (!source) { + g_object_unref (source_list); + fclose (fp); + + g_warning ("%s: No book source found, skipping.", G_STRFUNC); + return; + } book_client = e_book_client_new (source, &error); @@ -212,11 +221,11 @@ import_contacts (void) g_object_unref (source_list); - if (error != NULL) { + if (error != NULL || !book_client) { g_warning ( "%s: Failed to open book client: %s", - G_STRFUNC, error->message); - g_error_free (error); + G_STRFUNC, error ? error->message : "Unknown error"); + g_clear_error (&error); fclose (fp); return; } |