gm2
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gm2] double free or corruption with pointers


From: Martin Kalbfuß
Subject: [Gm2] double free or corruption with pointers
Date: Sun, 01 Aug 2010 11:55:07 +0200

Hi! The following program ends up with a double free corruption. I'm not
sure how this can happen. Anything wrong with my code?

MODULE test2;

IMPORT SYSTEM, SWholeIO, STextIO;
FROM Storage IMPORT ALLOCATE, DEALLOCATE;

TYPE DynArray = POINTER TO INTEGER;
VAR  myArray : DynArray;
     elementPtr : DynArray;
BEGIN
     NEW(myArray, 6, 6);
     elementPtr := SYSTEM.ADDADR(myArray, 2*5+3);
     SWholeIO.WriteInt(elementPtr^, 1); STextIO.WriteLn();
     DISPOSE(myArray);
END test2.


Thanks,
Martin




reply via email to

[Prev in Thread] Current Thread [Next in Thread]