From 874fbbff3473de9b5f2b5c29e93618cf634c7a5e Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Fri, 10 Jun 2016 12:59:30 +0200 Subject: [PATCH] Fix various leaks --- common/flatpak-dir.c | 4 +++- common/flatpak-run.c | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/common/flatpak-dir.c b/common/flatpak-dir.c index 18dc51351..2fd07c8c9 100644 --- a/common/flatpak-dir.c +++ b/common/flatpak-dir.c @@ -466,7 +466,7 @@ flatpak_load_override_keyfile (const char *app_id, gboolean user, GError **error FlatpakContext * flatpak_load_override_file (const char *app_id, gboolean user, GError **error) { - FlatpakContext *overrides = flatpak_context_new (); + g_autoptr(FlatpakContext) overrides = flatpak_context_new (); g_autoptr(GKeyFile) metakey = NULL; g_autoptr(GError) my_error = NULL; @@ -909,6 +909,8 @@ flatpak_dir_ensure_repo (FlatpakDir *self, } } + /* Make sure we didn't reenter weirdly */ + g_assert (self->repo == NULL); self->repo = g_object_ref (repo); } diff --git a/common/flatpak-run.c b/common/flatpak-run.c index f5262dc54..317c317fd 100644 --- a/common/flatpak-run.c +++ b/common/flatpak-run.c @@ -1557,7 +1557,7 @@ flatpak_run_add_system_dbus_args (FlatpakContext *context, { const char *dbus_address = g_getenv ("DBUS_SYSTEM_BUS_ADDRESS"); g_autofree char *real_dbus_address = NULL; - char *dbus_system_socket = NULL; + g_autofree char *dbus_system_socket = NULL; if (dbus_address != NULL) dbus_system_socket = extract_unix_path_from_dbus_address (dbus_address); @@ -1802,6 +1802,7 @@ flatpak_run_add_environment_args (GPtrArray *argv_array, path = g_build_filename ("/", dirent->d_name, NULL); add_file_arg (argv_array, fs_mode, path); } + closedir (dir); } add_file_arg (argv_array, fs_mode, "/run/media"); }