Fix CID 1491106, 1491129, 1491163, 1491231, 1491329 and 1491353: resource leaks.

This commit is contained in:
wwp 2021-09-29 16:45:19 +02:00
parent 7d41ed5f85
commit f73d8e9328
3 changed files with 17 additions and 11 deletions

View file

@ -2492,8 +2492,10 @@ gchar* vcal_add_event(const gchar *vevent)
VCalEvent *event = vcal_get_event_from_ical(vevent, NULL);
gchar *retVal = NULL;
Folder *folder = folder_find_from_name (PLUGIN_NAME, vcal_folder_get_class());
if (!folder)
if (!folder) {
vcal_manager_free_event(event);
return NULL;
}
if (event) {
if (vcal_event_exists(event->uid)) {

View file

@ -980,6 +980,7 @@ static gboolean check_attendees_availability(VCalMeeting *meet, gboolean tell_if
if (num_format > 2) {
g_warning("wrong format in %s!", real_url);
g_free(real_url);
g_free(internal_ifb);
return FALSE;
}
@ -1914,6 +1915,8 @@ gboolean vcal_meeting_export_calendar(const gchar *path,
_("There is nothing to export."),
_("_OK"), NULL, NULL, ALERTFOCUS_FIRST, FALSE,
NULL, ALERT_NOTICE);
g_free(tmpfile);
g_free(internal_file);
return FALSE;
} else {
str_write_to_file("", tmpfile, TRUE);
@ -1953,6 +1956,7 @@ gboolean vcal_meeting_export_calendar(const gchar *path,
if (str_write_to_file(icalcomponent_as_ical_string(calendar), tmpfile, TRUE) < 0) {
alertpanel_error(_("Could not export the calendar."));
g_free(tmpfile);
g_free(internal_file);
icalcomponent_free(calendar);
g_slist_free(list);
g_slist_free(subs);
@ -1974,6 +1978,7 @@ putfile:
if (automatic && (!path || strlen(path) == 0 || !vcalprefs.export_enable)) {
g_free(tmpfile);
g_free(internal_file);
g_free(file);
return TRUE;
}
@ -1984,7 +1989,7 @@ putfile:
&& strncmp(file, "webcal://", 9)
&& strncmp(file, "webcals://", 10)
&& strncmp(file, "ftp://", 6)) {
gchar *afile = NULL;
gchar *afile;
if (file[0] != G_DIR_SEPARATOR)
afile=g_strdup_printf("%s%s%s", get_home_dir(),
G_DIR_SEPARATOR_S, file);
@ -1996,7 +2001,6 @@ putfile:
res = FALSE;
}
g_free(afile);
g_free(file);
} else if (file) {
FILE *fp = claws_fopen(tmpfile, "rb");
if (!strncmp(file, "webcal", 6)) {
@ -2008,9 +2012,10 @@ putfile:
res = vcal_curl_put(file, fp, filesize, user, (pass != NULL ? pass : ""));
claws_fclose(fp);
}
g_free(file);
}
g_free(tmpfile);
g_free(internal_file);
g_free(file);
return res;
}

View file

@ -552,17 +552,14 @@ void vcalviewer_display_event (VCalViewer *vcalviewer, VCalEvent *event)
/* start */
if (event->start && *(event->start)) {
if (event->recur && *(event->recur)) {
gchar *tmp = g_strdup_printf(g_strconcat("%s <span weight=\"bold\">",
_("(this event recurs)"),"</span>", NULL),
event->start);
gchar *tmp = g_strdup_printf("%s <span weight=\"bold\">%s</span>",
_("(this event recurs)"), event->start);
GTK_LABEL_SET_TEXT_TRIMMED(GTK_LABEL(vcalviewer->start), tmp);
gtk_label_set_use_markup(GTK_LABEL(vcalviewer->start), TRUE);
g_free(tmp);
} else if (event->rec_occurrence) {
gchar *tmp = g_strdup_printf(g_strconcat("%s <span weight=\"bold\">",
_("(this event is part of a recurring event)"),
"</span>", NULL),
event->start);
gchar *tmp = g_strdup_printf("%s <span weight=\"bold\">%s</span>",
_("(this event is part of a recurring event)"), event->start);
GTK_LABEL_SET_TEXT_TRIMMED(GTK_LABEL(vcalviewer->start), tmp);
gtk_label_set_use_markup(GTK_LABEL(vcalviewer->start), TRUE);
g_free(tmp);
@ -732,6 +729,8 @@ static void vcalviewer_get_reply_values(VCalViewer *vcalviewer, MimeInfo *mimein
vcalviewer_display_event(vcalviewer, saved_event);
vcal_manager_free_event(saved_event);
return;
} else if (saved_event) {
vcal_manager_free_event(saved_event);
}
if (vcalviewer->event->organizer) {