summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2016-08-21 08:59:45 +0100
committerRichard Hughes <richard@hughsie.com>2016-08-21 09:16:51 +0100
commit481055cd02c5244bede06ca4a06ab55602d01505 (patch)
tree29a1fdf9e77f16742d5c29e282f917c350556e92
parent60033e61394562d706e703ad33e0d7e6583d83ce (diff)
downloadappstream-glib-481055cd02c5244bede06ca4a06ab55602d01505.tar.gz
trivial: Use the correct autoptr cleanup on yaml error
-rw-r--r--libappstream-glib/as-yaml.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/libappstream-glib/as-yaml.c b/libappstream-glib/as-yaml.c
index f65f75b..48e51f0 100644
--- a/libappstream-glib/as-yaml.c
+++ b/libappstream-glib/as-yaml.c
@@ -374,25 +374,10 @@ G_DEFINE_AUTO_CLEANUP_FREE_FUNC(AsYamlParser, yaml_parser_delete, NULL);
AsNode *
as_yaml_from_data (const gchar *data, gssize data_len, GError **error)
{
- g_autoptr(AsNode) node = NULL;
+ g_autoptr(AsYaml) node = NULL;
#if AS_BUILD_DEP11
yaml_parser_t parser;
g_auto(AsYamlParser) parser_cleanup = NULL;
- g_autofree gchar *prefix = NULL;
-
- /* sanity check */
- prefix = g_strndup (data, 64);
- g_strdelimit (prefix, "\n", '\0');
- if (!g_str_has_prefix (prefix, "---") &&
- !g_str_has_prefix (prefix, "#") &&
- !g_str_has_prefix (prefix, "File: ")) {
- g_set_error (error,
- AS_NODE_ERROR,
- AS_NODE_ERROR_INVALID_MARKUP,
- "YAML prefix invalid: %s expected '---' or '#'",
- prefix);
- return NULL;
- }
/* parse */
if (!yaml_parser_initialize (&parser)) {