diff options
author | Max Kellermann <max@duempel.org> | 2013-01-30 16:42:31 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-01-30 16:44:54 +0100 |
commit | 9920a3e8fcab775450e603750e83f35d6b9b1d53 (patch) | |
tree | bd91aaaf2626009e543a795e8b5d423ac9f7c41d | |
parent | f7d8e6c40c9adb7ae904dac4d887807bb0d17b68 (diff) | |
download | mpd-9920a3e8fcab775450e603750e83f35d6b9b1d53.tar.gz mpd-9920a3e8fcab775450e603750e83f35d6b9b1d53.tar.xz mpd-9920a3e8fcab775450e603750e83f35d6b9b1d53.zip |
InotifyUpdate: move code to destructor
-rw-r--r-- | src/InotifyUpdate.cxx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/InotifyUpdate.cxx b/src/InotifyUpdate.cxx index 2e7adb3fc..d56e0517b 100644 --- a/src/InotifyUpdate.cxx +++ b/src/InotifyUpdate.cxx @@ -61,6 +61,11 @@ struct WatchDirectory { :parent(_parent), name(g_strdup(_name)), descriptor(_descriptor), children(nullptr) {} + + ~WatchDirectory() { + g_free(name); + g_list_free(children); + } }; static InotifySource *inotify_source; @@ -117,7 +122,6 @@ remove_watch_directory(WatchDirectory *directory) g_list_remove(directory->parent->children, directory); inotify_source->Remove(directory->descriptor); - g_free(directory->name); delete directory; } @@ -352,10 +356,6 @@ mpd_inotify_finish(void) for (auto i : inotify_directories) { WatchDirectory *directory = i.second; - - g_free(directory->name); - g_list_free(directory->children); - delete directory; } |