summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2017-12-15 15:28:09 +0000
committerPhilip Withnall <withnall@endlessm.com>2017-12-15 16:19:13 +0000
commit96d591b5708ef9dfb4c02d2ae39b891f903d8a58 (patch)
tree3b36795348de72a0899102637d714f5060ffff25
parent32f873594cd7a91c25fa0ca6694bf3b3a25d9614 (diff)
downloadjson-glib-96d591b5708ef9dfb4c02d2ae39b891f903d8a58.tar.gz
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 <withnall@endlessm.com> https://gitlab.gnome.org/GNOME/json-glib/issues/30
-rw-r--r--json-glib/json-parser.c2
1 files changed, 2 insertions, 0 deletions
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);