Merge pull request #2512 from lucab/ups/variant-builder-error-memleak
libotutil: avoid leaking builder memory on error
This commit is contained in:
commit
92025018f6
|
|
@ -760,10 +760,10 @@ ot_variant_builder_info_new (OtVariantBuilder *builder, const GVariantType *type
|
||||||
{
|
{
|
||||||
OtVariantBuilderInfo *info;
|
OtVariantBuilderInfo *info;
|
||||||
|
|
||||||
info = (OtVariantBuilderInfo *) g_slice_new0 (OtVariantBuilderInfo);
|
|
||||||
|
|
||||||
g_return_val_if_fail (g_variant_type_is_container (type), NULL);
|
g_return_val_if_fail (g_variant_type_is_container (type), NULL);
|
||||||
|
|
||||||
|
info = (OtVariantBuilderInfo *) g_slice_new0 (OtVariantBuilderInfo);
|
||||||
|
|
||||||
info->builder = builder;
|
info->builder = builder;
|
||||||
info->type = g_variant_type_copy (type);
|
info->type = g_variant_type_copy (type);
|
||||||
info->type_info = g_variant_type_info_get (type);
|
info->type_info = g_variant_type_info_get (type);
|
||||||
|
|
@ -845,10 +845,10 @@ ot_variant_builder_new (const GVariantType *type,
|
||||||
{
|
{
|
||||||
OtVariantBuilder *builder;
|
OtVariantBuilder *builder;
|
||||||
|
|
||||||
builder = (OtVariantBuilder *) g_slice_new0 (OtVariantBuilder);
|
|
||||||
|
|
||||||
g_return_val_if_fail (g_variant_type_is_container (type), NULL);
|
g_return_val_if_fail (g_variant_type_is_container (type), NULL);
|
||||||
|
|
||||||
|
builder = (OtVariantBuilder *) g_slice_new0 (OtVariantBuilder);
|
||||||
|
|
||||||
builder->head = ot_variant_builder_info_new (builder, type);
|
builder->head = ot_variant_builder_info_new (builder, type);
|
||||||
builder->ref_count = 1;
|
builder->ref_count = 1;
|
||||||
builder->fd = fd;
|
builder->fd = fd;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue