mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-09-20 00:30:49 +00:00
Add default deleter for copy assign operator in SSHPublicKey
This commit is contained in:
parent
debf74a854
commit
d2964c7fe2
@ -45,7 +45,8 @@ SSHPublicKey & SSHPublicKey::operator=(const SSHPublicKey & other)
|
||||
{
|
||||
throw DB::Exception(DB::ErrorCodes::SSH_EXCEPTION, "Failed to duplicate ssh_key");
|
||||
}
|
||||
key.reset(new_key);
|
||||
key = UniqueKeyPtr(new_key, deleter); // We don't have access to the pointer from external code, opposed to non owning key object.
|
||||
// So here we always go for default deleter, regardless of other's
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
@ -61,7 +61,8 @@ private:
|
||||
// We may want to not own ssh_key memory, so then we pass this deleter to unique_ptr
|
||||
static void disabledDeleter(KeyPtr) { }
|
||||
|
||||
std::unique_ptr<ssh_key_struct, decltype(&deleter)> key;
|
||||
using UniqueKeyPtr = std::unique_ptr<ssh_key_struct, decltype(&deleter)>;
|
||||
UniqueKeyPtr key;
|
||||
};
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user