> malloc(): unsorted double linked list corrupted
> abort

Hello,
I could not reproduce this in a minimal bullseye or trixie amd64 VM,
and also not in a bookworm i386 VM.

But valgrind shows a few "Mismatched free() / delete / delete []"
or "Conditional jump or move depends on uninitialised value(s)".
Maybe those are responsible for the malloc abort.

Attached file fixes most of the issues shown by valgrind entering the main menu.

Kind regards,
Bernhard
Description: Fix a few delete and uninitilised values shown by valgrind

Author: Bernhard Übelacker <buebelac...@mailbox.org>
Last-Update: 2024-03-30

Index: gl-117-1.3.2/src/3ds.cpp
===================================================================
--- gl-117-1.3.2.orig/src/3ds.cpp
+++ gl-117-1.3.2/src/3ds.cpp
@@ -69,7 +69,7 @@ BinaryFile::BinaryFile (char *filename)
 
 BinaryFile::~BinaryFile ()
 {
-  delete data;
+  delete[] data;
 }
 
 int BinaryFile::readFloat (float *f)
@@ -503,7 +503,7 @@ void CLoad3DS::ReadUVCoordinates (CObjec
   
   for (int i = 0; i < object->numTexVertex; i ++)
     object->vertex [i].tex.take (&p [i]);
-  delete p;
+  delete[] p;
 }
 
 void CLoad3DS::ReadVertices (CObject *object, Chunk *previousChunk)
@@ -532,7 +532,7 @@ void CLoad3DS::ReadVertices (CObject *ob
     object->vertex [i].vector.y = object->vertex [i].vector.z;
     object->vertex [i].vector.z = -fTempY;
   }
-  delete p;
+  delete[] p;
 }
 
 void CLoad3DS::ReadObjectMaterial (CModel *model, CObject *object, Chunk 
*previousChunk)
Index: gl-117-1.3.2/src/model.cpp
===================================================================
--- gl-117-1.3.2.orig/src/model.cpp
+++ gl-117-1.3.2/src/model.cpp
@@ -616,7 +616,7 @@ CModel::~CModel ()
     delete object [i];
   if (refpoint)
   {
-    delete refpoint;
+    delete[] refpoint;
   }
 }
 
Index: gl-117-1.3.2/src/gl.cpp
===================================================================
--- gl-117-1.3.2.orig/src/gl.cpp
+++ gl-117-1.3.2/src/gl.cpp
@@ -239,10 +239,11 @@ void GL::shadeSmooth ()
 
 void GL::enableFog (float view)
 {
-  float fcol [3];
+  float fcol [4];
   fcol [0] = fogcolor [0] * foglum;
   fcol [1] = fogcolor [1] * foglum;
   fcol [2] = fogcolor [2] * foglum;
+  fcol [3] = 0.0;
   glEnable (GL_FOG);
   glFogfv (GL_FOG_COLOR, fcol);
   glFogf (GL_FOG_DENSITY, 0.1);
Index: gl-117-1.3.2/src/aiobject.cpp
===================================================================
--- gl-117-1.3.2.orig/src/aiobject.cpp
+++ gl-117-1.3.2/src/aiobject.cpp
@@ -87,6 +87,7 @@ void DynamicObj::dinit ()
   forcex = 0; forcez = 0; forcey = 0;
   maxthrust = 0.3; braking = 0/*0.99*/; manoeverability = 0.5;
   thrust = maxthrust; recthrust = thrust; recheight = 5.0;
+  realspeed = 1.0;
   ttl = -1;
   shield = 0.01F; maxshield = 0.01F;
   immunity = 0;

Reply via email to