[ASAN] tree-wide: Clean up gvariant-related leaks

I kept thinking `^a&s` was sufficient for allocation-free reading
of `as`, but it's not, we need to free the outer buffer.  Other
minor cases were using `s` instead of `&s`.

Closes: #533
Approved by: jlebon
This commit is contained in:
Colin Walters 2016-12-05 15:21:32 -05:00 committed by Atomic Bot
parent 7095c313d8
commit 975c0703c3
3 changed files with 6 additions and 6 deletions

View File

@ -135,7 +135,7 @@ status_generic (RPMOSTreeSysroot *sysroot_proxy,
g_assert (g_variant_dict_lookup (dict, "osname", "&s", &os_name));
g_assert (g_variant_dict_lookup (dict, "id", "&s", &id));
g_assert (g_variant_dict_lookup (dict, "serial", "i", &serial));
g_assert (g_variant_dict_lookup (dict, "checksum", "s", &checksum));
g_assert (g_variant_dict_lookup (dict, "checksum", "&s", &checksum));
g_assert (g_variant_dict_lookup (dict, "timestamp", "t", &t));
{ g_autoptr(GDateTime) timestamp = g_date_time_new_from_unix_utc (t);
@ -145,7 +145,7 @@ status_generic (RPMOSTreeSysroot *sysroot_proxy,
timestamp_string = g_strdup_printf ("(invalid timestamp)");
}
if (g_variant_dict_lookup (dict, "origin", "s", &origin_refspec))
if (g_variant_dict_lookup (dict, "origin", "&s", &origin_refspec))
{
if (g_variant_dict_lookup (dict, "packages", "^a&s", &origin_packages))
{

View File

@ -75,7 +75,7 @@ rpmostreed_deployment_gpg_results (OstreeRepo *repo,
guint n_sigs, i;
gboolean gpg_verify;
GVariantBuilder builder;
g_auto(GVariantBuilder) builder;
g_variant_builder_init (&builder, G_VARIANT_TYPE ("av"));

View File

@ -572,8 +572,8 @@ rpmostree_context_setup (RpmOstreeContext *self,
{
gboolean ret = FALSE;
GPtrArray *repos = NULL;
char **enabled_repos = NULL;
char **instlangs = NULL;
g_autofree char **enabled_repos = NULL;
g_autofree char **instlangs = NULL;
self->spec = g_object_ref (spec);
@ -962,7 +962,7 @@ rpmostree_context_prepare_install (RpmOstreeContext *self,
{
gboolean ret = FALSE;
DnfContext *hifctx = self->hifctx;
char **pkgnames = NULL;
g_autofree char **pkgnames = NULL;
g_autoptr(RpmOstreeInstall) ret_install = g_object_new (RPMOSTREE_TYPE_INSTALL, NULL);
g_assert (g_variant_dict_lookup (self->spec->dict, "packages", "^a&s", &pkgnames));