aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgeneticdrift <geneticdrift@iotide.com>2014-02-06 23:08:24 +0100
committerMax Kellermann <max@duempel.org>2014-02-06 23:08:24 +0100
commit0f1f509be7c0c8c40c5dbd9b4cb7aebaa5b4dd59 (patch)
tree5e4fd485be5ecd156f2cd392d7907b2aed7a5c58
parentc8f0c7e9ede1cfef49ea9d4b71b6b56b4ae87141 (diff)
downloadmpd-0f1f509be7c0c8c40c5dbd9b4cb7aebaa5b4dd59.tar.gz
mpd-0f1f509be7c0c8c40c5dbd9b4cb7aebaa5b4dd59.tar.xz
mpd-0f1f509be7c0c8c40c5dbd9b4cb7aebaa5b4dd59.zip
fixed leaked LocalDirectoryReader *const reader in UpdateWalk::UpdateDirectory
-rw-r--r--src/db/update/Walk.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/db/update/Walk.cxx b/src/db/update/Walk.cxx
index 5750f0223..0ea1eb450 100644
--- a/src/db/update/Walk.cxx
+++ b/src/db/update/Walk.cxx
@@ -47,6 +47,7 @@
#include <string.h>
#include <stdlib.h>
#include <errno.h>
+#include <memory>
UpdateWalk::UpdateWalk(EventLoop &_loop, DatabaseListener &_listener,
Storage &_storage)
@@ -320,9 +321,8 @@ UpdateWalk::UpdateDirectory(Directory &directory, const FileInfo &info)
directory_set_stat(directory, info);
Error error;
- StorageDirectoryReader *const reader =
- storage.OpenDirectory(directory.GetPath(), error);
- if (reader == nullptr) {
+ const std::auto_ptr<StorageDirectoryReader> reader(storage.OpenDirectory(directory.GetPath(), error));
+ if (reader.get() == nullptr) {
LogError(error);
return false;
}