summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Withnall <withnall@endlessm.com>2017-12-15 15:28:09 +0000
committerEmmanuele Bassi <ebassi@gnome.org>2018-03-13 11:15:47 +0000
commit15304031d6324123b6dfb120bdac344ed9f165f7 (patch)
tree917255df234f226c5a214f54040c35f0110c6a96
parent1207c209f11097f7348952dc849a59d95a5b1923 (diff)
downloadjson-glib-15304031d6324123b6dfb120bdac344ed9f165f7.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 (cherry picked from commit 96d591b5708ef9dfb4c02d2ae39b891f903d8a58) Signed-off-by: Emmanuele Bassi <ebassi@gnome.org>
-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 0f87ba4..1155783 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);