I have recently been programming a small Cell Simulation to be used as the background of a menu in a game.
I was under the impression that the Updating/Drawing function "MenuAnimation()" worked correctly, however when testing for a memory leak in another function I discovered that Valgrind reports many Invalid Read/Writes throughout the duration of the function.
I am somewhat perplexed as to what could be causing these, as they seem to occur for no reason what so ever, lines of code that bear no relation to one another will both throw the same Invalid Read Or Write.
I have attached a small test program which contains only the Resetting/Updating and Drawing functions from the game and the Valgrind log.
Any help you can provide on the matter would be greatly appreciated.
P.S: I am compiling using GCC version 4.5.2 on Ubuntu 11.04.