mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-29 00:46:16 +01:00
Merge branch 'mcatanzaro/fb-free' into 'master'
Don't free FileBuilder in serialize function See merge request GNOME/gvdb!6
This commit is contained in:
commit
8696b6bbb7
@ -450,6 +450,13 @@ file_builder_new (gboolean byteswap)
|
|||||||
return builder;
|
return builder;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
file_builder_free (FileBuilder *fb)
|
||||||
|
{
|
||||||
|
g_queue_free (fb->chunks);
|
||||||
|
g_slice_free (FileBuilder, fb);
|
||||||
|
}
|
||||||
|
|
||||||
static GString *
|
static GString *
|
||||||
file_builder_serialise (FileBuilder *fb,
|
file_builder_serialise (FileBuilder *fb,
|
||||||
struct gvdb_pointer root)
|
struct gvdb_pointer root)
|
||||||
@ -494,9 +501,6 @@ file_builder_serialise (FileBuilder *fb,
|
|||||||
g_slice_free (FileChunk, chunk);
|
g_slice_free (FileChunk, chunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_queue_free (fb->chunks);
|
|
||||||
g_slice_free (FileBuilder, fb);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,6 +522,7 @@ gvdb_table_write_contents (GHashTable *table,
|
|||||||
fb = file_builder_new (byteswap);
|
fb = file_builder_new (byteswap);
|
||||||
file_builder_add_hash (fb, table, &root);
|
file_builder_add_hash (fb, table, &root);
|
||||||
str = file_builder_serialise (fb, root);
|
str = file_builder_serialise (fb, root);
|
||||||
|
file_builder_free (fb);
|
||||||
|
|
||||||
status = g_file_set_contents (filename, str->str, str->len, error);
|
status = g_file_set_contents (filename, str->str, str->len, error);
|
||||||
g_string_free (str, TRUE);
|
g_string_free (str, TRUE);
|
||||||
@ -594,6 +599,7 @@ gvdb_table_write_contents_async (GHashTable *table,
|
|||||||
file_builder_add_hash (fb, table, &root);
|
file_builder_add_hash (fb, table, &root);
|
||||||
str = file_builder_serialise (fb, root);
|
str = file_builder_serialise (fb, root);
|
||||||
bytes = g_string_free_to_bytes (str);
|
bytes = g_string_free_to_bytes (str);
|
||||||
|
file_builder_free (fb);
|
||||||
|
|
||||||
file = g_file_new_for_path (filename);
|
file = g_file_new_for_path (filename);
|
||||||
data = write_contents_data_new (bytes, file);
|
data = write_contents_data_new (bytes, file);
|
||||||
|
Loading…
Reference in New Issue
Block a user