fixed leaked LocalDirectoryReader *const reader in UpdateWalk::UpdateDirectory

This commit is contained in:
geneticdrift 2014-02-06 23:08:24 +01:00 committed by Max Kellermann
parent c8f0c7e9ed
commit 0f1f509be7

View File

@ -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;
}