Cleanup - malloc/free shouldn't be inside loops, allocate the memory once and
be done with it!
Authored by: sms00 2005-10-04
Parent: [r2870]
Child: [r2872]