storage/smbclient: use std::lock_guard

This commit is contained in:
Max Kellermann 2019-04-25 19:23:14 +02:00
parent 84c406d5f5
commit 2c0a968735

View File

@ -59,9 +59,8 @@ public:
:base(_base), ctx(_ctx) {} :base(_base), ctx(_ctx) {}
virtual ~SmbclientStorage() { virtual ~SmbclientStorage() {
smbclient_mutex.lock(); const std::lock_guard<Mutex> lock(smbclient_mutex);
smbc_free_context(ctx, 1); smbc_free_context(ctx, 1);
smbclient_mutex.unlock();
} }
/* virtual methods from class Storage */ /* virtual methods from class Storage */
@ -153,9 +152,8 @@ SkipNameFS(const char *name) noexcept
SmbclientDirectoryReader::~SmbclientDirectoryReader() SmbclientDirectoryReader::~SmbclientDirectoryReader()
{ {
smbclient_mutex.lock(); const std::lock_guard<Mutex> lock(smbclient_mutex);
smbc_close(handle); smbc_close(handle);
smbclient_mutex.unlock();
} }
const char * const char *