fix malloc in locations