summaryrefslogtreecommitdiff
path: root/json-glib/json-node.c
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@openedhand.com>2007-10-29 18:16:24 +0000
committerEmmanuele Bassi <ebassi@openedhand.com>2007-10-29 18:16:24 +0000
commit72d007d865a822875dfa311698fb2d13f5d3df69 (patch)
tree0663a1e53a477928115af919abae56c63cafc83a /json-glib/json-node.c
parent59a66484befba457eda2ee7a9540f2b33ff04031 (diff)
downloadjson-glib-72d007d865a822875dfa311698fb2d13f5d3df69.tar.gz
Check if the payload is set in json_node_free()
Before calling json_object_unref() or json_array_unref() in json_node_free() we need to check if the payload of JsonNode is set to avoid a critical.
Diffstat (limited to 'json-glib/json-node.c')
-rw-r--r--json-glib/json-node.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/json-glib/json-node.c b/json-glib/json-node.c
index 7f1e9a7..48ea3bf 100644
--- a/json-glib/json-node.c
+++ b/json-glib/json-node.c
@@ -330,11 +330,13 @@ json_node_free (JsonNode *node)
switch (node->type)
{
case JSON_NODE_OBJECT:
- json_object_unref (node->data.object);
+ if (node->data.object)
+ json_object_unref (node->data.object);
break;
case JSON_NODE_ARRAY:
- json_array_unref (node->data.array);
+ if (node->data.array)
+ json_array_unref (node->data.array);
break;
case JSON_NODE_VALUE: