I think this should fix the eventRemoveContext crashes that we have.
It assumes that the bison/flex stuff frees its own allocations, so we
don't have to. I could not see any leaks, but did not test that much,
since my box tends to hang after running valgrind a while.

Comments? Testing results?

  - Per
Index: lib/script/event.c
===================================================================
--- lib/script/event.c	(revision 5146)
+++ lib/script/event.c	(working copy)
@@ -671,15 +671,10 @@
 		}
 	}
 
-	// Free it's variables
+	// Free variables (contents freed in parser where they were allocated)
 	for(psCChunk = psContext->psGlobals; psCChunk; psCChunk = psNChunk)
 	{
 		psNChunk = psCChunk->psNext;
-		for(i=0;i < CONTEXT_VALS ; i++)
-		{
-			if(psCChunk->asVals[i].type == VAL_STRING && psCChunk->asVals[i].v.sval)
-				free(psCChunk->asVals[i].v.sval);
-		}
 		free(psCChunk);
 	}
 
_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev

Reply via email to