Fixed memory bugs in INIFile and MipMap generation