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
This commit is contained in:
Krzesimir Nowak 2016-05-24 10:36:38 +02:00 committed by Atomic Bot
parent e3e82c54c1
commit 2f2af9252d

View File

@ -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 *