memory leak by assigning and freeing a variable appropriately as well as keeping track of the amount of allocated ram properly. MFC after: 1 month