diff --git a/gio/glib-compile-schemas.c b/gio/glib-compile-schemas.c index acabfb6b4..efe6f8e77 100644 --- a/gio/glib-compile-schemas.c +++ b/gio/glib-compile-schemas.c @@ -709,8 +709,8 @@ key_state_serialise (KeyState *state) gsize size; gsize i; - data = state->strinfo->str; size = state->strinfo->len; + data = g_string_free_and_steal (g_steal_pointer (&state->strinfo)); words = data; for (i = 0; i < size / sizeof (guint32); i++) @@ -720,9 +720,6 @@ key_state_serialise (KeyState *state) data, size, TRUE, g_free, data); - g_string_free (state->strinfo, FALSE); - state->strinfo = NULL; - g_variant_builder_add (&builder, "(y@au)", state->is_flags ? 'f' : state->is_enum ? 'e' : 'c', diff --git a/glib/gkeyfile.c b/glib/gkeyfile.c index 6ae738ca1..fb65d55c5 100644 --- a/glib/gkeyfile.c +++ b/glib/gkeyfile.c @@ -3546,10 +3546,7 @@ g_key_file_get_key_comment (GKeyFile *key_file, } if (string != NULL) - { - comment = string->str; - g_string_free (string, FALSE); - } + comment = g_string_free_and_steal (g_steal_pointer (&string)); else comment = NULL; diff --git a/glib/tests/markup-subparser.c b/glib/tests/markup-subparser.c index e2e94ea90..626b4274d 100644 --- a/glib/tests/markup-subparser.c +++ b/glib/tests/markup-subparser.c @@ -83,9 +83,7 @@ subparser_end (GMarkupParseContext *ctx, char *result; string = g_markup_parse_context_pop (ctx); - result = string->str; - - g_string_free (string, FALSE); + result = g_string_free_and_steal (g_steal_pointer (&string)); strings_allocated--; if (result == NULL || result[0] == '\0') @@ -156,9 +154,7 @@ replay_parser_end (GMarkupParseContext *ctx, return NULL; } - result = string->str; - - g_string_free (string, FALSE); + result = g_string_free_and_steal (g_steal_pointer (&string)); strings_allocated--; if (result == NULL || result[0] == '\0')