diff --git a/src/builder-context.c b/src/builder-context.c index 58bef3ee..f813f3f4 100644 --- a/src/builder-context.c +++ b/src/builder-context.c @@ -115,6 +115,7 @@ builder_context_finalize (GObject *object) g_clear_object (&self->checksums_dir); g_clear_object (&self->rofiles_dir); g_clear_object (&self->ccache_dir); + g_clear_object (&self->rofiles_allocated_dir); g_clear_object (&self->app_dir); g_clear_object (&self->run_dir); g_clear_object (&self->base_dir); @@ -1087,7 +1088,7 @@ builder_context_set_enable_ccache (BuilderContext *self, for (i = 0; i < G_N_ELEMENTS (compilers); i++) { - const char *symlink_path = g_build_filename (ccache_bin_path, compilers[i], NULL); + g_autofree char *symlink_path = g_build_filename (ccache_bin_path, compilers[i], NULL); if (symlink ("/usr/bin/ccache", symlink_path) && errno != EEXIST) { glnx_set_error_from_errno (error); diff --git a/src/builder-flatpak-utils.c b/src/builder-flatpak-utils.c index 77339a4f..ac55285e 100644 --- a/src/builder-flatpak-utils.c +++ b/src/builder-flatpak-utils.c @@ -645,7 +645,7 @@ flatpak_build_file_va (GFile *base, while ((arg = va_arg (args, const gchar *))) { - GFile *child = g_file_resolve_relative_path (res, arg); + g_autoptr(GFile) child = g_file_resolve_relative_path (res, arg); g_set_object (&res, child); } diff --git a/src/builder-manifest.c b/src/builder-manifest.c index 61d22f14..74d1074f 100644 --- a/src/builder-manifest.c +++ b/src/builder-manifest.c @@ -2544,6 +2544,8 @@ builder_manifest_find_appdata_file (BuilderManifest *self, source = g_file_get_child (appdata_dir, basename); if (g_file_query_exists (source, NULL)) return g_steal_pointer (&source); + + g_clear_object (&source); } } return NULL; @@ -2941,7 +2943,7 @@ builder_manifest_cleanup (BuilderManifest *self, G_KEY_FILE_DESKTOP_GROUP, "X-Flatpak-RenamedFrom", NULL, NULL); - const char **new_renames = NULL; + g_autofree const char **new_renames = NULL; int old_rename_len = 0; int new_rename_len = 0; diff --git a/src/builder-module.c b/src/builder-module.c index bce91b7f..ef24f066 100644 --- a/src/builder-module.c +++ b/src/builder-module.c @@ -1260,7 +1260,8 @@ setup_build_args (GFile *app_dir, g_ptr_array_add (args, g_file_get_path (app_dir)); - *cwd_file = g_file_new_for_path (source_dir_path_canonical); + if (cwd_file) + *cwd_file = g_file_new_for_path (source_dir_path_canonical); return g_steal_pointer (&args); } @@ -1350,7 +1351,7 @@ build (GFile *app_dir, va_end (ap); args = - setup_build_args (app_dir, module_name, context, source_dir, cwd_subdir, flatpak_opts, env, &cwd_file); + setup_build_args (app_dir, module_name, context, source_dir, cwd_subdir, flatpak_opts, env, NULL); unresolved_args = setup_build_args (app_dir, module_name, context, source_dir, cwd_subdir, flatpak_opts, unresolved_env, &cwd_file); diff --git a/src/builder-options.c b/src/builder-options.c index 2abcea78..8c04c9e6 100644 --- a/src/builder-options.c +++ b/src/builder-options.c @@ -858,7 +858,7 @@ get_all_options (BuilderOptions *self, BuilderContext *context) return options; } -static const char * +static char * builder_options_get_flags (BuilderOptions *self, BuilderContext *context, size_t field_offset, @@ -913,7 +913,7 @@ get_sdk_flags (BuilderOptions *self, BuilderContext *context, const char *(*meth return NULL; } -const char * +char * builder_options_get_cflags (BuilderOptions *self, BuilderContext *context) { return builder_options_get_flags (self, context, G_STRUCT_OFFSET (BuilderOptions, cflags), @@ -921,7 +921,7 @@ builder_options_get_cflags (BuilderOptions *self, BuilderContext *context) get_sdk_flags (self, context, builder_sdk_config_get_cflags)); } -const char * +char * builder_options_get_cxxflags (BuilderOptions *self, BuilderContext *context) { return builder_options_get_flags (self, context, G_STRUCT_OFFSET (BuilderOptions, cxxflags), @@ -929,7 +929,7 @@ builder_options_get_cxxflags (BuilderOptions *self, BuilderContext *context) get_sdk_flags (self, context, builder_sdk_config_get_cxxflags)); } -const char * +char * builder_options_get_cppflags (BuilderOptions *self, BuilderContext *context) { return builder_options_get_flags (self, context, G_STRUCT_OFFSET (BuilderOptions, cppflags), @@ -937,7 +937,7 @@ builder_options_get_cppflags (BuilderOptions *self, BuilderContext *context) get_sdk_flags (self, context, builder_sdk_config_get_cppflags)); } -const char * +char * builder_options_get_ldflags (BuilderOptions *self, BuilderContext *context) { return builder_options_get_flags (self, context, G_STRUCT_OFFSET (BuilderOptions, ldflags), @@ -1134,7 +1134,10 @@ builder_options_get_env (BuilderOptions *self, BuilderContext *context) GList *l; int i; char **envp = NULL; - const char *cflags, *cppflags, *cxxflags, *ldflags; + g_autofree char *cflags = NULL; + g_autofree char *cppflags = NULL; + g_autofree char *cxxflags = NULL; + g_autofree char *ldflags = NULL; envp = builder_context_extend_env_pre (context, envp); diff --git a/src/builder-options.h b/src/builder-options.h index 05ba2480..7f9fe9c1 100644 --- a/src/builder-options.h +++ b/src/builder-options.h @@ -37,14 +37,14 @@ typedef struct BuilderOptions BuilderOptions; GType builder_options_get_type (void); -const char *builder_options_get_cflags (BuilderOptions *self, - BuilderContext *context); -const char *builder_options_get_cxxflags (BuilderOptions *self, - BuilderContext *context); -const char *builder_options_get_cppflags (BuilderOptions *self, - BuilderContext *context); -const char *builder_options_get_ldflags (BuilderOptions *self, - BuilderContext *context); +char *builder_options_get_cflags (BuilderOptions *self, + BuilderContext *context); +char *builder_options_get_cxxflags (BuilderOptions *self, + BuilderContext *context); +char *builder_options_get_cppflags (BuilderOptions *self, + BuilderContext *context); +char *builder_options_get_ldflags (BuilderOptions *self, + BuilderContext *context); const char *builder_options_get_prefix (BuilderOptions *self, BuilderContext *context); const char *builder_options_get_libdir (BuilderOptions *self,