diff --git a/include/WinStd/Sec.h b/include/WinStd/Sec.h index 427d6763..b6a9f74d 100644 --- a/include/WinStd/Sec.h +++ b/include/WinStd/Sec.h @@ -63,7 +63,7 @@ namespace winstd /// /// PCredHandle wrapper class /// - class WINSTD_API sec_credentials : public handle + class WINSTD_API sec_credentials : public handle { WINSTD_NONCOPYABLE(sec_credentials) @@ -95,7 +95,7 @@ namespace winstd /// inline sec_credentials(_Inout_ sec_credentials &&h) : m_expires(std::move(h.m_expires)), - handle(std::move(h)) + handle(std::move(h)) { } @@ -114,8 +114,8 @@ namespace winstd sec_credentials& operator=(_Inout_ sec_credentials &&h) { if (this != std::addressof(h)) { - *(handle*)this = std::move(h); - m_expires = std::move(h.m_expires); + *(handle*)this = std::move(h); + m_expires = std::move(h.m_expires); } return *this; } @@ -165,7 +165,7 @@ namespace winstd /// /// PCtxtHandle wrapper class /// - class WINSTD_API sec_context : public handle + class WINSTD_API sec_context : public handle { public: /// @@ -173,7 +173,7 @@ namespace winstd /// inline sec_context() : m_attrib(0), - handle() + handle() { m_expires.QuadPart = -1; } @@ -186,7 +186,7 @@ namespace winstd inline sec_context(_Inout_ sec_context &&h) : m_attrib (std::move(h.m_attrib )), m_expires(std::move(h.m_expires)), - handle(std::move(h)) + handle(std::move(h)) { } @@ -205,7 +205,7 @@ namespace winstd sec_context& operator=(_Inout_ sec_context &&h) { if (this != std::addressof(h)) { - *(handle*)this = std::move(h); + *(handle*)this = std::move(h); m_attrib = std::move(h.m_attrib); m_expires = std::move(h.m_expires); } diff --git a/src/Sec.cpp b/src/Sec.cpp index 1eb84378..fe5ea721 100644 --- a/src/Sec.cpp +++ b/src/Sec.cpp @@ -29,7 +29,7 @@ winstd::sec_credentials::~sec_credentials() { - if (m_h) { + if (m_h != invalid) { FreeCredentialsHandle(m_h); delete m_h; } @@ -49,7 +49,7 @@ void winstd::sec_credentials::free_internal() winstd::sec_context::~sec_context() { - if (m_h) { + if (m_h != invalid) { DeleteSecurityContext(m_h); delete m_h; }