BUG#:8697
authormarek <marek>
Fri, 29 Jan 2010 10:05:04 +0000 (10:05 +0000)
committermarek <marek>
Fri, 29 Jan 2010 10:05:04 +0000 (10:05 +0000)
TITLE: SCMO Functions not aware of 8 byte alignment

DESCRIPTION:

src/Pegasus/Common/SCMO.cpp

index 88e1206292d7c9dd42ae7d61a42980f16f9af9f8..433d5faf942a809bd7f16df9b356e9177071b38e 100644 (file)
@@ -2316,7 +2316,7 @@ void SCMOInstance::setHostName(const char* hostName)
 void SCMOInstance::setHostName_l(const char* hostName, Uint32 len)
 {
     // Copy on Write is only necessary if a realloc() becomes necessary
-    if (inst.mem->freeBytes < len)
+    if (inst.mem->freeBytes < ((len+8) & ~7))
     {
         _copyOnWrite();
     }
@@ -2411,7 +2411,7 @@ void SCMOInstance::setNameSpace(const char* nameSpace)
 void SCMOInstance::setNameSpace_l(const char* nameSpace, Uint32 len)
 {
     // Copy on Write is only necessary if a realloc() becomes necessary
-    if (inst.mem->freeBytes < len)
+    if (inst.mem->freeBytes < ((len+8) & ~7))
     {
         _copyOnWrite();
     }
@@ -6831,6 +6831,8 @@ Uint64 _getFreeSpace(
     // Init memory from unaligned start up to the size required with alignment
     // to zero.
     memset(&((char*)(*pmem))[start],0,(size_t)reqAlignSize);
+    PEGASUS_DEBUG_ASSERT(
+        ((*pmem)->freeBytes+(*pmem)->startOfFreeSpace) == (*pmem)->totalSize);
 
     return alignedStart;
 }