rem: if(new_map == NULL)
add: if(new_map == NULL) { recursive_lock_destroy(&new_map->lock);
context: int vm_translation_map_create(vm_translation_map *new_map, bool kernel){	if(new_map == NULL)		return EINVAL;dprintf("vm_translation_map_create\n");	// initialize the new object	new_map->ops = &tmap_ops;	new_map->map_count = 0;	if(recursive_lock_create(&new_map->lock) < 0)		return ENOMEM;	new_map->arch_data = (vm_translation_map_arch_info *)kmalloc(sizeof(vm_translation_map_arch_info));	if(new_map == NULL)		return ENOMEM;	new_map->arch_data->num_invalidate_pages = 0;	if(!kernel) {		// user		// allocate a pgdir		new_map->arch_data->pgdir_virt = kmalloc(PAGE_SIZE);		if(new_map->arch_data->pgdir_virt == NULL) {			kfree(new_map->arch_data);			return ENOMEM;		}		if(((addr)new_map->arch_data->pgdir_virt % PAGE_SIZE) != 0)			panic("vm_translation_map_create: malloced pgdir and found it wasn't aligned!\n");		vm_get_page_mapping(vm_get_kernel_aspace_id(), (addr)new_map->arch_data->pgdir_virt, (addr *)&new_map->arch_data->pgdir_phys);	} else {		// kernel		// we already know the kernel pgdir mapping		(addr)new_map->arch_data->pgdir_virt = kernel_pgdir_virt;		(addr)new_map->arch_data->pgdir_phys = kernel_pgdir_phys;	}	// zero out the bottom portion of the new pgdir	memset(new_map->arch_data->pgdir_virt + FIRST_USER_PGDIR_ENT, 0, NUM_USER_PGDIR_ENTS * sizeof(pdentry));	// insert this new map into the map list	{		int state = disable_interrupts();		acquire_spinlock(&tmap_list_lock);		// copy the top portion of the pgdir from the current one		memcpy(new_map->arch_data->pgdir_virt + FIRST_KERNEL_PGDIR_ENT, kernel_pgdir_virt + FIRST_KERNEL_PGDIR_ENT,			NUM_KERNEL_PGDIR_ENTS * sizeof(pdentry));		new_map->next = tmap_list;		tmap_list = new_map;		release_spinlock(&tmap_list_lock);		restore_interrupts(state);	}	return 0;}