From 570c6374806d0f1ec59cf7a72543efe6b5b637be Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Fri, 15 Nov 2013 09:06:57 +0100 Subject: Fix/mute issues found by Coverity scan This makes the code free of Coverity scan issues. It is sometimes quite pedantic and expects/suggests some coding habits, thus certain changes may look weird, but for a good thing, I hope. The code is also tagged with Coverity scan suppressions, to keep the code as is and hide the warning too. Also note that Coverity treats g_return_if_fail(), g_assert() and similar macros as unreliable, and it's true these can be disabled during the compile time, thus it brings in other set of 'weird' changes. --- calendar/importers/icalendar-importer.c | 44 ++++++++++++++------------------- 1 file changed, 19 insertions(+), 25 deletions(-) (limited to 'calendar/importers/icalendar-importer.c') diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c index 2368643877..83fc9521c0 100644 --- a/calendar/importers/icalendar-importer.c +++ b/calendar/importers/icalendar-importer.c @@ -1004,34 +1004,28 @@ gnome_calendar_import (EImport *ei, g_free (filename); /* If we couldn't load the file, just return. FIXME: Error message? */ - if (!icalcomp) - goto out; - - ici = g_malloc0 (sizeof (*ici)); - ici->ei = ei; - ici->target = target; - ici->cancellable = g_cancellable_new (); - ici->icalcomp = icalcomp; - icalcomp = NULL; - - g_datalist_set_data_full (&target->data, "gnomecal-data", ici, free_ici); - - prepare_events (ici->icalcomp, &ici->tasks); - if (do_calendar) { - open_default_source (ici, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, gc_import_events); - return; - } + if (icalcomp) { + ici = g_malloc0 (sizeof (*ici)); + ici->ei = ei; + ici->target = target; + ici->cancellable = g_cancellable_new (); + ici->icalcomp = icalcomp; + + g_datalist_set_data_full (&target->data, "gnomecal-data", ici, free_ici); + + prepare_events (ici->icalcomp, &ici->tasks); + if (do_calendar) { + open_default_source (ici, E_CAL_CLIENT_SOURCE_TYPE_EVENTS, gc_import_events); + return; + } - prepare_tasks (ici->icalcomp, ici->tasks); - if (do_tasks) { - open_default_source (ici, E_CAL_CLIENT_SOURCE_TYPE_TASKS, gc_import_tasks); - return; + prepare_tasks (ici->icalcomp, ici->tasks); + if (do_tasks) { + open_default_source (ici, E_CAL_CLIENT_SOURCE_TYPE_TASKS, gc_import_tasks); + return; + } } - out: - if (icalcomp) - icalcomponent_free (icalcomp); - e_import_complete (ei, target); } -- cgit v1.2.3