summaryrefslogtreecommitdiffstats
path: root/src/Node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Node.cpp')
-rw-r--r--src/Node.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/Node.cpp b/src/Node.cpp
index aaadd52..3da401e 100644
--- a/src/Node.cpp
+++ b/src/Node.cpp
@@ -88,7 +88,12 @@ Node::Node(plist_type type, Node* parent) : _parent(parent)
Node::~Node()
{
- plist_free(_node);
+ /* If the Node is in a container, let _node be cleaned up by
+ * operations on the parent plist_t. Otherwise, duplicate frees
+ * occur when a Node is removed from or replaced in a Dictionary.
+ */
+ if (_parent == NULL)
+ plist_free(_node);
_node = NULL;
_parent = NULL;
}