It seems to me that you are trying to 'free' something that was never 'malloc'ed.
This is bad.

You have malloc'ed just one big block of memory, not lots of little ones.
Therefore you cant free just the last index, because you cant free "just a part" of a block.
Not as far as I am aware.


PS :: Why are you still using malloc and free, rather than sys_malloc and sys_free? (un-important question)


"There is no fate but what WE make." - CEO Cyberdyne Systems Corp.
A8.30.5 Commercial