[ASAN] lib: Squash various leaks in library and commandline

The pull one is the most likely to affect users.  Otherwise mostly
just cleaning up `-fsanitize=address`.

Closes: #587
Approved by: jlebon
This commit is contained in:
Colin Walters authored and Atomic Bot committed 2016-11-21 16:34:06 +00:00
1 parent eb7ba645af
commit 49b8a72622
12 files changed
+30 -13

No files matched your search

+3
View File
@@ -632,6 +632,9 @@ _ostree_metalink_request_sync (OstreeMetalink *self,
if (mainctx)
g_main_context_pop_thread_default (mainctx);
g_clear_object (&request.metalink);
g_clear_pointer (&request.verification_sha256, g_free);
g_clear_pointer (&request.verification_sha512, g_free);
g_clear_pointer (&request.last_metalink_error, g_free);
g_clear_pointer (&request.urls, g_ptr_array_unref);
g_clear_pointer (&request.parser, g_markup_parse_context_free);
return ret;
+4 -1
View File
@@ -943,7 +943,10 @@ ostree_repo_write_archive_to_mtree (OstreeRepo *self,
ret = TRUE;
out:
if (a)
(void)archive_read_close (a);
{
(void)archive_read_close (a);
(void)archive_read_free (a);
}
return ret;
#else
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
+3 -3
View File
@@ -1982,7 +1982,7 @@ _ostree_repo_remote_new_fetcher (OstreeRepo *self,
g_autofree char *cookie_file = g_strdup_printf ("%s.cookies.txt",
remote_name);
jar_path = g_build_filename (g_file_get_path (self->repodir), cookie_file,
jar_path = g_build_filename (gs_file_get_path_cached (self->repodir), cookie_file,
NULL);
if (g_file_test(jar_path, G_FILE_TEST_IS_REGULAR))
@@ -2061,7 +2061,7 @@ fetch_mirrorlist (OstreeFetcher *fetcher,
GError **error)
{
gboolean ret = FALSE;
char **lines = NULL;
g_auto(GStrv) lines = NULL;
g_autofree char *contents = NULL;
SoupURI *mirrorlist = NULL;
g_autoptr(GPtrArray) ret_mirrorlist =
@@ -2367,7 +2367,7 @@ ostree_repo_pull_with_options (OstreeRepo *self,
const char *dir_to_pull = NULL;
g_autofree char **dirs_to_pull = NULL;
g_autofree char **refs_to_fetch = NULL;
char **override_commit_ids = NULL;
g_autofree char **override_commit_ids = NULL;
GSource *update_timeout = NULL;
gboolean disable_static_deltas = FALSE;
gboolean require_static_deltas = FALSE;
@@ -243,7 +243,7 @@ _ostree_delta_compute_similar_objects (OstreeRepo *repo,
{
gboolean ret = FALSE;
g_autoptr(GHashTable) ret_modified_regfile_content =
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)g_ptr_array_unref);
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_free);
g_autoptr(GPtrArray) from_sizes = NULL;
g_autoptr(GPtrArray) to_sizes = NULL;
guint i, j;
@@ -880,7 +880,9 @@ _ostree_repo_static_delta_dump (OstreeRepo *self,
OT_VARIANT_MAP_TRUSTED, &delta_superblock, error))
goto out;
g_print ("%s\n", g_variant_print (delta_superblock, 1));
{ g_autofree char *variant_string = g_variant_print (delta_superblock, 1);
g_print ("%s\n", variant_string);
}
g_print ("Delta: %s\n", delta_id);
{ const char *endianness_description;
+2 -2
View File
@@ -258,7 +258,7 @@ initable_init (GInitable *initable,
g_autoptr(GFileInputStream) filein = NULL;
g_autoptr(GDataInputStream) datain = NULL;
gboolean enabled = FALSE;
char *policytype = NULL;
g_autofree char *policytype = NULL;
const char *selinux_prefix = "SELINUX=";
const char *selinuxtype_prefix = "SELINUXTYPE=";
@@ -352,7 +352,7 @@ initable_init (GInitable *initable,
goto out;
}
self->selinux_policy_name = g_strdup (policytype);
self->selinux_policy_name = g_steal_pointer (&policytype);
self->selinux_policy_root = g_object_ref (etc_selinux_dir);
}
+1 -1
View File
@@ -491,7 +491,7 @@ prune_repo (OstreeRepo *repo,
if (freed_space > 0)
{
char *freed_space_str = g_format_size_full (freed_space, 0);
g_autofree char *freed_space_str = g_format_size_full (freed_space, 0);
g_print ("Freed objects: %s\n", freed_space_str);
}
+1
View File
@@ -105,6 +105,7 @@ parse_refspec (OstreeSysrootUpgrader *self,
csum = g_key_file_get_string (self->origin, "origin", "override-commit", NULL);
if (csum != NULL && !ostree_validate_checksum_string (csum, error))
goto out;
g_clear_pointer (&self->override_csum, g_free);
self->override_csum = g_steal_pointer (&csum);
ret = TRUE;