diff options
author | Aaron Burghardt | 2015-12-07 16:16:40 +0100 |
---|---|---|
committer | Nikias Bassen | 2015-12-07 16:16:40 +0100 |
commit | 060eda6b1846968aa40b0d38dcf92ac46f933417 (patch) | |
tree | 5c36a7ef0da97480813382921e86a79ed98376a5 /src/Node.cpp | |
parent | 9834d85ca473ef9b229dcf4c0df758e18a4149ad (diff) | |
download | libplist-060eda6b1846968aa40b0d38dcf92ac46f933417.tar.gz libplist-060eda6b1846968aa40b0d38dcf92ac46f933417.tar.bz2 |
Node.cpp: let plist_t operations free _node when in a container.
Fixes libimobiledevice/libplist#50.
Diffstat (limited to 'src/Node.cpp')
-rw-r--r-- | src/Node.cpp | 7 |
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; } |