Its causing me memory leaks. In lines 13-40. I have no idea whats causing this so I would like someone to look at it for me.

Thanks allready in advance.

http://nopaste.php-q.net/226119