aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-06-04 01:18:56 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-06-04 01:28:44 +0200
commitefc13db66e890a712d8ffa7a2e4289a285137d60 (patch)
tree5adb5894f055d93f2cbe0c80d56b8418feb29995
parentb6315482b78a7d51d9dd45374567040e256b427f (diff)
downloadfiv-efc13db66e890a712d8ffa7a2e4289a285137d60.tar.gz
fiv-efc13db66e890a712d8ffa7a2e4289a285137d60.tar.xz
fiv-efc13db66e890a712d8ffa7a2e4289a285137d60.zip
Plug two memory leaks
-rw-r--r--fiv-io.c11
-rw-r--r--fiv-sidebar.c1
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;
}