if (nd) kfree(nd); 
kfree(nd); 
static int hpfs_add_to_dnode(struct inode *i, dnode_secno dno,			     unsigned char *name, unsigned namelen,			     struct hpfs_dirent *new_de, dnode_secno down_ptr){	struct quad_buffer_head qbh, qbh1, qbh2;	struct dnode *d, *ad, *rd, *nd = NULL;	dnode_secno adno, rdno;	struct hpfs_dirent *de;	struct hpfs_dirent nde;	char *nname;	int h;	int pos;	struct buffer_head *bh;	struct fnode *fnode;	int c1, c2 = 0;	if (!(nname = kmalloc(256, GFP_NOFS))) {		printk("HPFS: out of memory, can't add to dnode\n");		return 1;	}	go_up:	if (namelen >= 256) {		hpfs_error(i->i_sb, "hpfs_add_to_dnode: namelen == %d", namelen);		if (nd) kfree(nd);		kfree(nname);		return 1;	}	if (!(d = hpfs_map_dnode(i->i_sb, dno, &qbh))) {		if (nd) kfree(nd);		kfree(nname);		return 1;	}	go_up_a:	if (hpfs_sb(i->i_sb)->sb_chk)		if (hpfs_stop_cycles(i->i_sb, dno, &c1, &c2, "hpfs_add_to_dnode")) {			hpfs_brelse4(&qbh);			if (nd) kfree(nd);			kfree(nname);			return 1;		}	if (d->first_free + de_size(namelen, down_ptr) <= 2048) {		loff_t t;		copy_de(de=hpfs_add_de(i->i_sb, d, name, namelen, down_ptr), new_de);		t = get_pos(d, de);		for_all_poss(i, hpfs_pos_ins, t, 1);		for_all_poss(i, hpfs_pos_subst, 4, t);		for_all_poss(i, hpfs_pos_subst, 5, t + 1);		hpfs_mark_4buffers_dirty(&qbh);		hpfs_brelse4(&qbh);		if (nd) kfree(nd);		kfree(nname);		return 0;	}	if (!nd) if (!(nd = kmalloc(0x924, GFP_NOFS))) {		/* 0x924 is a max size of dnode after adding a dirent with		   max name length. We alloc this only once. There must		   not be any error while splitting dnodes, otherwise the		   whole directory, not only file we're adding, would		   be lost. */		printk("HPFS: out of memory for dnode splitting\n");		hpfs_brelse4(&qbh);		kfree(nname);		return 1;	}		memcpy(nd, d, d->first_free);	copy_de(de = hpfs_add_de(i->i_sb, nd, name, namelen, down_ptr), new_de);	for_all_poss(i, hpfs_pos_ins, get_pos(nd, de), 1);	h = ((char *)dnode_last_de(nd) - (char *)nd) / 2 + 10;	if (!(ad = hpfs_alloc_dnode(i->i_sb, d->up, &adno, &qbh1, 0))) {		hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted");		hpfs_brelse4(&qbh);		kfree(nd);		kfree(nname);		return 1;	}	i->i_size += 2048;	i->i_blocks += 4;	pos = 1;	for (de = dnode_first_de(nd); (char *)de_next_de(de) - (char *)nd < h; de = de_next_de(de)) {		copy_de(hpfs_add_de(i->i_sb, ad, de->name, de->namelen, de->down ? de_down_pointer(de) : 0), de);		for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | pos, ((loff_t)adno << 4) | pos);		pos++;	}	copy_de(new_de = &nde, de);	memcpy(name = nname, de->name, namelen = de->namelen);	for_all_poss(i, hpfs_pos_subst, ((loff_t)dno << 4) | pos, 4);	down_ptr = adno;	set_last_pointer(i->i_sb, ad, de->down ? de_down_pointer(de) : 0);	de = de_next_de(de);	memmove((char *)nd + 20, de, nd->first_free + (char *)nd - (char *)de);	nd->first_free -= (char *)de - (char *)nd - 20;	memcpy(d, nd, nd->first_free);	for_all_poss(i, hpfs_pos_del, (loff_t)dno << 4, pos);	fix_up_ptrs(i->i_sb, ad);	if (!d->root_dnode) {		dno = ad->up = d->up;		hpfs_mark_4buffers_dirty(&qbh);		hpfs_brelse4(&qbh);		hpfs_mark_4buffers_dirty(&qbh1);		hpfs_brelse4(&qbh1);		goto go_up;	}	if (!(rd = hpfs_alloc_dnode(i->i_sb, d->up, &rdno, &qbh2, 0))) {		hpfs_error(i->i_sb, "unable to alloc dnode - dnode tree will be corrupted");		hpfs_brelse4(&qbh);		hpfs_brelse4(&qbh1);		kfree(nd);		kfree(nname);		return 1;	}	i->i_size += 2048;	i->i_blocks += 4;	rd->root_dnode = 1;	rd->up = d->up;	if (!(fnode = hpfs_map_fnode(i->i_sb, d->up, &bh))) {		hpfs_free_dnode(i->i_sb, rdno);		hpfs_brelse4(&qbh);		hpfs_brelse4(&qbh1);		hpfs_brelse4(&qbh2);		kfree(nd);		kfree(nname);		return 1;	}	fnode->u.external[0].disk_secno = rdno;	mark_buffer_dirty(bh);	brelse(bh);	d->up = ad->up = hpfs_i(i)->i_dno = rdno;	d->root_dnode = ad->root_dnode = 0;	hpfs_mark_4buffers_dirty(&qbh);	hpfs_brelse4(&qbh);	hpfs_mark_4buffers_dirty(&qbh1);	hpfs_brelse4(&qbh1);	qbh = qbh2;	set_last_pointer(i->i_sb, rd, dno);	dno = rdno;	d = rd;	goto go_up_a;}
4520	/local/tlutelli/issta_data/temp/c/2005_temp/2005/4520/f99d49adf527fa6f7a9c42257fa76bca6b8df1e3/dnode.c/clean/fs/hpfs/dnode.c