|KDirWatch fix memory leak on destruction.patch | (download)
8 5 + 3 - 0 !
3 2 + 1 - 0 !
2 files changed, 7 insertions(+), 4 deletions(-)
kdirwatch: fix memory leak on destruction.
The Entry class owns the Client instances, so it should delete the
remaining instances in its destructor, for the case where they haven't
been removed one by one. The line of code removeEntries(nullptr) was
probably means to remove them one by one, but it was a no-op (the code
for that method doesn't expect nullptr as argument) and it would be
slow anyway. We don't need to call inotify_remove for every path,
when we're just cleaning up in a global static after qApp destruction.
Detected by a clang-sanitizer build on http://ci-logs.kde.flaska.net
and reproduced locally with valgrind.
./kdirwatch_*_unittest now passes in valgrind without memory
leaks being reported
Reviewers: aacid, mpyne
Reviewed By: aacid, mpyne
Subscribers: markg, #frameworks