summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Aaron Burghardt2015-12-07 16:16:40 +0100
committerGravatar Nikias Bassen2015-12-07 16:16:40 +0100
commit060eda6b1846968aa40b0d38dcf92ac46f933417 (patch)
tree5c36a7ef0da97480813382921e86a79ed98376a5
parent9834d85ca473ef9b229dcf4c0df758e18a4149ad (diff)
downloadlibplist-060eda6b1846968aa40b0d38dcf92ac46f933417.tar.gz
libplist-060eda6b1846968aa40b0d38dcf92ac46f933417.tar.bz2
Node.cpp: let plist_t operations free _node when in a container.
Fixes libimobiledevice/libplist#50.
-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)
88 88
89Node::~Node() 89Node::~Node()
90{ 90{
91 plist_free(_node); 91 /* If the Node is in a container, let _node be cleaned up by
92 * operations on the parent plist_t. Otherwise, duplicate frees
93 * occur when a Node is removed from or replaced in a Dictionary.
94 */
95 if (_parent == NULL)
96 plist_free(_node);
92 _node = NULL; 97 _node = NULL;
93 _parent = NULL; 98 _parent = NULL;
94} 99}