Tools/MeshExtractor: Fix uninitialized values

Fix uninitialized struct padding bytes written to output files. These bytes are actually ignored when loading these files, so the main point of this fix is to shut up the Valgrind log.

Valgrind log:
 Syscall param write(buf) points to uninitialised byte(s)
  at : ??? (syscall-template.S:81)
  by : _IO_file_write@@GLIBC_2.2.5 (fileops.c:1270)
  by : new_do_write (fileops.c:546)
  by : _IO_do_write@@GLIBC_2.2.5 (fileops.c:519)
  by : _IO_file_xsputn@@GLIBC_2.2.5 (fileops.c:1341)
  by : fwrite (iofwrite.c:43)
  by  BuilderThread::svc() (ContinentBuilder.cpp:56)
  by : ACE_Task_Base::svc_run(void*) (in /usr/lib/libACE-6.0.3.so)
  by : ACE_Thread_Adapter::invoke_i() (in /usr/lib/libACE-6.0.3.so)
  by : ACE_Thread_Adapter::invoke() (in /usr/lib/libACE-6.0.3.so)
  by : start_thread (pthread_create.c:311)
  by : clone (clone.S:113)
 Address 0x4039011 is not stack'd, malloc'd or (recently) free'd
 Uninitialised value was created by a stack allocation
  at: BuilderThread::svc() (ContinentBuilder.cpp:30)
This commit is contained in:
jackpoz committed 2013-10-08 20:38:42 +02:00
1 parent b1ed66b52d
commit 6f63d430b0
3 files changed
+14 -4

No files matched your search

+10
View File
@@ -455,3 +455,13 @@ WMOGroupHeader WMOGroupHeader::Read(Stream* stream)
return ret;
}
void Utils::InitializeMmapTileHeader(MmapTileHeader& header)
{
memset(&header, 0, sizeof(MmapTileHeader));
header.mmapMagic = MMAP_MAGIC;
header.dtVersion = DT_NAVMESH_VERSION;
header.mmapVersion = MMAP_VERSION;
header.size = 0;
header.usesLiquids = true;
}