From: Krzesimir Nowak Date: Tue, 24 May 2016 08:36:38 +0000 (+0200) Subject: libotutil: Plug a leak X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~426^2^2~70 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=2f2af9252db84b2a0c91324788722c4335411c8b;p=ostree.git libotutil: Plug a leak There's no need to allocate the variant builder on a heap, so allocate it on the stack and avoid a memory leak at the same time. Closes: #307 Approved by: cgwalters --- diff --git a/src/libotutil/ot-variant-utils.c b/src/libotutil/ot-variant-utils.c index 2dc07582..7b54542e 100644 --- a/src/libotutil/ot-variant-utils.c +++ b/src/libotutil/ot-variant-utils.c @@ -33,7 +33,10 @@ GVariant * ot_gvariant_new_empty_string_dict (void) { - return g_variant_builder_end (g_variant_builder_new (G_VARIANT_TYPE ("a{sv}"))); + g_auto(GVariantBuilder) builder = {{0,}}; + + g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}")); + return g_variant_builder_end (&builder); } GVariant *