Commit 47f54b56 authored by Max Kellermann's avatar Max Kellermann

input/smbclient: close handle on stat error

parent fbfa1723
...@@ -90,8 +90,11 @@ input_smbclient_open(const char *uri, ...@@ -90,8 +90,11 @@ input_smbclient_open(const char *uri,
throw MakeErrno("smbc_open() failed"); throw MakeErrno("smbc_open() failed");
struct stat st; struct stat st;
if (ctx.Stat(handle, st) < 0) if (ctx.Stat(handle, st) < 0) {
throw MakeErrno("smbc_fstat() failed"); const int e = errno;
ctx.Close(handle);
throw MakeErrno(e, "smbc_fstat() failed");
}
return std::make_unique<MaybeBufferedInputStream> return std::make_unique<MaybeBufferedInputStream>
(std::make_unique<SmbclientInputStream>(uri, mutex, (std::make_unique<SmbclientInputStream>(uri, mutex,
......
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