libimobiledevice/libplist — pull request #39 by hattmammerly (2014-08-12 00:52:50+00:00)
Title: added missing include, removed double-frees in Array.cpp

Two bugs existed when I freshly cloned the repository: a missing #include kept the library from compiling and a redundant plist_free() call caused the library to segfault when calling the Remove member of PList::Array.

The Remove member calls plist_array_remove_item() which amounts to a call to plist_free() and that is called from the PList::Node destructor. After the first call, _node->children will be null, and during the second call node_iterator_create() will try to dereference it.

Testing code: https://gist.github.com/hattmammerly/a9b05f71020416b7b828
Compile error without `#include ` added in Node.h: https://gist.github.com/hattmammerly/6dcf5347dfdb7fd99c3d
Backtrace of segfault occurring when calling PList::Array::Remove: https://gist.github.com/hattmammerly/95e2cb70761be4493327

Please feel free to contact me with questions.

Thanks!