Commit 9920a3e8 authored by Max Kellermann's avatar Max Kellermann

InotifyUpdate: move code to destructor

parent f7d8e6c4
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment