Plug two memory leaks

This commit is contained in:
Přemysl Eric Janouch 2022-06-04 01:18:56 +02:00
parent b6315482b7
commit efc13db66e
Signed by: p
GPG Key ID: A0420B94F92B9493
2 changed files with 6 additions and 6 deletions

View File

@ -2939,7 +2939,7 @@ model_reload(FivIoModel *self, GError **error)
if (self->filtering && g_file_info_get_is_hidden(info)) if (self->filtering && g_file_info_get_is_hidden(info))
continue; continue;
ModelEntry entry = {}; ModelEntry entry = {.uri = g_file_get_uri(child)};
GDateTime *mtime = g_file_info_get_modification_date_time(info); GDateTime *mtime = g_file_info_get_modification_date_time(info);
if (mtime) { if (mtime) {
entry.mtime_msec = g_date_time_to_unix(mtime) * 1000 + entry.mtime_msec = g_date_time_to_unix(mtime) * 1000 +
@ -2954,13 +2954,12 @@ model_reload(FivIoModel *self, GError **error)
g_free(parse_name); g_free(parse_name);
const char *name = g_file_info_get_name(info); const char *name = g_file_info_get_name(info);
if (g_file_info_get_file_type(info) == G_FILE_TYPE_DIRECTORY) { if (g_file_info_get_file_type(info) == G_FILE_TYPE_DIRECTORY)
entry.uri = g_file_get_uri(child);
g_array_append_val(self->subdirs, entry); g_array_append_val(self->subdirs, entry);
} else if (!self->filtering || model_supports(self, name)) { else if (!self->filtering || model_supports(self, name))
entry.uri = g_file_get_uri(child);
g_array_append_val(self->files, entry); g_array_append_val(self->files, entry);
} else
model_entry_finalize(&entry);
} }
g_object_unref(enumerator); g_object_unref(enumerator);

View File

@ -209,6 +209,7 @@ create_row(FivSidebar *self, GFile *file, const char *icon_name)
gtk_container_add(GTK_CONTAINER(row), revealer); gtk_container_add(GTK_CONTAINER(row), revealer);
gtk_widget_show_all(row); gtk_widget_show_all(row);
g_object_unref(info);
return row; return row;
} }