diff --git a/src/lock/lock.cpp b/src/lock/lock.cpp index c023cc2b93..72c7a737c2 100644 --- a/src/lock/lock.cpp +++ b/src/lock/lock.cpp @@ -1119,10 +1119,8 @@ void LockManager::acquire_shmem(SRQ_PTR owner_offset) locked = true; break; } - else - { - m_blockage = true; - } + + m_blockage = true; } // If the spin wait didn't succeed then wait forever @@ -1170,7 +1168,8 @@ void LockManager::acquire_shmem(SRQ_PTR owner_offset) fb_assert(!m_sharedFileCreated); ++sh_mem_header->lhb_acquires; - if (m_blockage) { + if (m_blockage) + { ++sh_mem_header->lhb_acquire_blocks; m_blockage = false; } diff --git a/src/remote/client/interface.cpp b/src/remote/client/interface.cpp index 743d543952..7a68847265 100644 --- a/src/remote/client/interface.cpp +++ b/src/remote/client/interface.cpp @@ -5491,13 +5491,14 @@ static void authFillParametersBlock(ClntAuthBlock& cBlock, ClumpletWriter& dpb, } } -static CSTRING* REMOTE_dup_string(CSTRING* from) +static CSTRING* REMOTE_dup_string(const CSTRING* from) { if (from && from->cstr_length) { CSTRING* rc = FB_NEW(*getDefaultMemoryPool()) CSTRING; memset(rc, 0, sizeof(CSTRING)); rc->cstr_length = from->cstr_length; + rc->cstr_allocated = rc->cstr_length; rc->cstr_address = FB_NEW(*getDefaultMemoryPool()) UCHAR[rc->cstr_length]; memcpy(rc->cstr_address, from->cstr_address, rc->cstr_length); return rc; @@ -5512,6 +5513,7 @@ static void REMOTE_free_string(CSTRING* tmp) { if (tmp->cstr_address) { + fb_assert(tmp->cstr_allocated >= tmp->cstr_length); delete[] tmp->cstr_address; } delete tmp; diff --git a/src/remote/remote.h b/src/remote/remote.h index 5810fe14b9..54ba756038 100644 --- a/src/remote/remote.h +++ b/src/remote/remote.h @@ -700,7 +700,7 @@ public: AuthServerPlugins* plugins; Auth::WriterImplementation authBlockWriter; - SrvAuthBlock(rem_port* p_port) + explicit SrvAuthBlock(rem_port* p_port) : port(p_port), userName(getPool()), pluginName(getPool()), pluginList(getPool()), dataForPlugin(getPool()), dataFromPlugin(getPool()), @@ -754,7 +754,7 @@ public: : Firebird::AutoStorage(), type(getPool()), plugins(getPool()) { } - KnownServerKey(Firebird::MemoryPool& p) + explicit KnownServerKey(Firebird::MemoryPool& p) : Firebird::AutoStorage(p), type(getPool()), plugins(getPool()) { } diff --git a/src/remote/server/server.cpp b/src/remote/server/server.cpp index 0dd4256572..35a83c5606 100644 --- a/src/remote/server/server.cpp +++ b/src/remote/server/server.cpp @@ -235,7 +235,7 @@ public: authPort(port), dbName(getPool()) { - if (!port->port_srv_auth_block) + if (!authPort->port_srv_auth_block) { authPort->port_srv_auth_block = new SrvAuthBlock(authPort); } @@ -639,7 +639,7 @@ class CryptKeyTypeManager : public PermanentStorage class CryptKeyType : public PermanentStorage { public: - CryptKeyType(MemoryPool& p) + explicit CryptKeyType(MemoryPool& p) : PermanentStorage(p), keyType(getPool()), plugins(getPool()) { } @@ -671,7 +671,7 @@ class CryptKeyTypeManager : public PermanentStorage }; public: - CryptKeyTypeManager(MemoryPool& p) + explicit CryptKeyTypeManager(MemoryPool& p) : PermanentStorage(p), knownTypes(getPool()) { LocalStatus st; diff --git a/src/yvalve/why.cpp b/src/yvalve/why.cpp index cda8317c15..878ab93d23 100644 --- a/src/yvalve/why.cpp +++ b/src/yvalve/why.cpp @@ -5045,13 +5045,12 @@ void Dispatcher::shutdown(IStatus* userStatus, unsigned int timeout, const int r { YService* service = accessor.current()->second; if (service->enterCount) - { hasThreads = true; - continue; + else + { + service->addRef(); + svcStack.push(service); } - - service->addRef(); - svcStack.push(service); } while (accessor.getNext()); } } @@ -5077,13 +5076,12 @@ void Dispatcher::shutdown(IStatus* userStatus, unsigned int timeout, const int r { YAttachment* attachment = accessor.current()->second; if (attachment->enterCount) - { hasThreads = true; - continue; + else + { + attachment->addRef(); + attStack.push(attachment); } - - attachment->addRef(); - attStack.push(attachment); } while (accessor.getNext()); } }