From 96d591b5708ef9dfb4c02d2ae39b891f903d8a58 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 15 Dec 2017 15:28:09 +0000 Subject: json-parser: Fix a memory leak on two error handling paths Small leak. With some additional fixes to the tests themselves, this makes all the tests run valgrind-clean. (See the following commit.) Signed-off-by: Philip Withnall https://gitlab.gnome.org/GNOME/json-glib/issues/30 --- json-glib/json-parser.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'json-glib/json-parser.c') diff --git a/json-glib/json-parser.c b/json-glib/json-parser.c index bdb7123..015c861 100644 --- a/json-glib/json-parser.c +++ b/json-glib/json-parser.c @@ -746,6 +746,7 @@ json_parse_object (JsonParser *parser, { priv->error_code = JSON_PARSER_ERROR_TRAILING_COMMA; + g_free (name); json_object_unref (object); json_node_unref (member); json_node_unref (priv->current_node); @@ -758,6 +759,7 @@ json_parse_object (JsonParser *parser, { priv->error_code = JSON_PARSER_ERROR_MISSING_COMMA; + g_free (name); json_object_unref (object); json_node_unref (member); json_node_unref (priv->current_node); -- cgit v1.2.1