Fix some leaks of floating GVariants
ostree_repo_pull_with_options() and ostree_repo_remote_change() don't sink floating GVariant arguments, and doing so now would be an ABI change; so don't rely on them to do so. Leak found with valgrind memcheck. Signed-off-by: Simon McVittie <smcv@debian.org> Closes: #556 Approved by: cgwalters
This commit is contained in:
parent
53f1fabfbe
commit
24af123c53
|
|
@ -208,6 +208,7 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError **
|
|||
|
||||
{
|
||||
GVariantBuilder builder;
|
||||
g_autoptr(GVariant) options = NULL;
|
||||
g_auto(GLnxConsoleRef) console = { 0, };
|
||||
g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));
|
||||
|
||||
|
|
@ -265,7 +266,9 @@ ostree_builtin_pull (int argc, char **argv, GCancellable *cancellable, GError **
|
|||
&console);
|
||||
}
|
||||
|
||||
if (!ostree_repo_pull_with_options (repo, remote, g_variant_builder_end (&builder),
|
||||
options = g_variant_ref_sink (g_variant_builder_end (&builder));
|
||||
|
||||
if (!ostree_repo_pull_with_options (repo, remote, options,
|
||||
progress, cancellable, error))
|
||||
goto out;
|
||||
|
||||
|
|
|
|||
|
|
@ -50,6 +50,7 @@ ot_remote_builtin_add (int argc, char **argv, GCancellable *cancellable, GError
|
|||
const char *remote_url;
|
||||
char **iter;
|
||||
g_autoptr(GVariantBuilder) optbuilder = NULL;
|
||||
g_autoptr(GVariant) options = NULL;
|
||||
gboolean ret = FALSE;
|
||||
|
||||
context = g_option_context_new ("NAME [metalink=|mirrorlist=]URL [BRANCH...] - Add a remote repository");
|
||||
|
|
@ -109,11 +110,13 @@ ot_remote_builtin_add (int argc, char **argv, GCancellable *cancellable, GError
|
|||
"gpg-verify",
|
||||
g_variant_new_variant (g_variant_new_boolean (FALSE)));
|
||||
|
||||
options = g_variant_ref_sink (g_variant_builder_end (optbuilder));
|
||||
|
||||
if (!ostree_repo_remote_change (repo, NULL,
|
||||
opt_if_not_exists ? OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS :
|
||||
OSTREE_REPO_REMOTE_CHANGE_ADD,
|
||||
remote_name, remote_url,
|
||||
g_variant_builder_end (optbuilder),
|
||||
options,
|
||||
cancellable, error))
|
||||
goto out;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue