diff options
author | Emmanuele Bassi <ebassi@gmail.com> | 2021-10-09 16:07:06 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gmail.com> | 2021-10-09 16:07:06 +0000 |
commit | a64aff2b4ae07e86f4f0fa3f3e9c17d4214f5e92 (patch) | |
tree | bf90ad9fd203aa5e727ff0c9c191490e33b1753d /json-glib/json-node.c | |
parent | 2472b804aa5071e49d93d5a6453a27e6384b4a82 (diff) | |
parent | 40996bfad16896b6e715c1d1bad5f72ec3125021 (diff) | |
download | json-glib-a64aff2b4ae07e86f4f0fa3f3e9c17d4214f5e92.tar.gz |
Merge branch 'safe-node-init' into 'master'
set node->data pointer to null when unset
See merge request GNOME/json-glib!37
Diffstat (limited to 'json-glib/json-node.c')
-rw-r--r-- | json-glib/json-node.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/json-glib/json-node.c b/json-glib/json-node.c index 2737453..1e573eb 100644 --- a/json-glib/json-node.c +++ b/json-glib/json-node.c @@ -144,18 +144,15 @@ json_node_unset (JsonNode *node) switch (node->type) { case JSON_NODE_OBJECT: - if (node->data.object) - json_object_unref (node->data.object); + g_clear_pointer (&(node->data.object), json_object_unref); break; case JSON_NODE_ARRAY: - if (node->data.array) - json_array_unref (node->data.array); + g_clear_pointer (&(node->data.array), json_array_unref); break; case JSON_NODE_VALUE: - if (node->data.value) - json_value_unref (node->data.value); + g_clear_pointer (&(node->data.value), json_value_unref); break; case JSON_NODE_NULL: |