From efc13db66e890a712d8ffa7a2e4289a285137d60 Mon Sep 17 00:00:00 2001 From: Přemysl Eric Janouch Date: Sat, 4 Jun 2022 01:18:56 +0200 Subject: Plug two memory leaks --- fiv-io.c | 11 +++++------ fiv-sidebar.c | 1 + 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fiv-io.c b/fiv-io.c index 1968a80..1b35a4e 100644 --- a/fiv-io.c +++ b/fiv-io.c @@ -2939,7 +2939,7 @@ model_reload(FivIoModel *self, GError **error) if (self->filtering && g_file_info_get_is_hidden(info)) continue; - ModelEntry entry = {}; + ModelEntry entry = {.uri = g_file_get_uri(child)}; GDateTime *mtime = g_file_info_get_modification_date_time(info); if (mtime) { entry.mtime_msec = g_date_time_to_unix(mtime) * 1000 + @@ -2954,13 +2954,12 @@ model_reload(FivIoModel *self, GError **error) g_free(parse_name); const char *name = g_file_info_get_name(info); - if (g_file_info_get_file_type(info) == G_FILE_TYPE_DIRECTORY) { - entry.uri = g_file_get_uri(child); + if (g_file_info_get_file_type(info) == G_FILE_TYPE_DIRECTORY) g_array_append_val(self->subdirs, entry); - } else if (!self->filtering || model_supports(self, name)) { - entry.uri = g_file_get_uri(child); + else if (!self->filtering || model_supports(self, name)) g_array_append_val(self->files, entry); - } + else + model_entry_finalize(&entry); } g_object_unref(enumerator); diff --git a/fiv-sidebar.c b/fiv-sidebar.c index e5c2c5b..e4bbd5d 100644 --- a/fiv-sidebar.c +++ b/fiv-sidebar.c @@ -209,6 +209,7 @@ create_row(FivSidebar *self, GFile *file, const char *icon_name) gtk_container_add(GTK_CONTAINER(row), revealer); gtk_widget_show_all(row); + g_object_unref(info); return row; } -- cgit v1.2.3-70-g09d2