From 08c58267177f51b516d8a5ec944e74bb4a9dfb88 Mon Sep 17 00:00:00 2001 From: Roland Lutz Date: Fri, 11 Dec 2020 15:06:03 +0100 Subject: [PATCH] libgeda: Don't double free path argument --- libgeda/src/edaconfig.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/libgeda/src/edaconfig.c b/libgeda/src/edaconfig.c index 551a420e6..07b214c8e 100644 --- a/libgeda/src/edaconfig.c +++ b/libgeda/src/edaconfig.c @@ -521,16 +521,17 @@ eda_config_get_context_for_file (GFile *path) g_once_init_leave (&initialized, 1); } - if (path == NULL) { + if (path != NULL) { + g_return_val_if_fail (G_IS_FILE (path), NULL); + + /* Find the project root, and the corresponding configuration + * filename. */ + root = find_project_root (path); + } else { path = g_file_new_for_path ("."); + root = find_project_root (path); + g_object_unref (path); } - - g_return_val_if_fail (G_IS_FILE (path), NULL); - - /* Find the project root, and the corresponding configuration - * filename. */ - root = find_project_root (path); - g_object_unref(path); file = g_file_get_child (root, LOCAL_CONFIG_NAME); /* If there's already a context available for this file, return -- 2.11.4.GIT