Thought I'd clarify what I said.
The bad line is in BulkSendMerchantInventory right after it picks a random item from handyitem.  Code looks something like this.
	APPLAYER* outapp = new APPLAYER(OP_ShopItem, 5000);
	outapp->size = 2 + DeflatePacket((uchar*) cpi->packets, cpi->count * sizeof(MerchantItemD_Struct), &outapp->pBuffer[2], 5000-2);
	MerchantItem_Struct* cpi2 = (MerchantItem_Struct*) outapp->pBuffer;
	cpi2->count = cpi->count;
	QueuePacket(outapp);
	//DumpPacket(outapp);
	//printf("Merchant has %i items available.\n",cpi->count);
	delete outapp;
//	delete cpi;  << bad line 

  handyitem not done with it yet 
 
	Mob* merch = entity_list.GetMob(npcid);
	if(merch != 0 && handyitem)
	{
	... blah blah blah...	}
	delete cpi; //   <<  good line 
 
}
Hope that clears things up. 

  Sorry that post was so confusing.  Lack-o-sleep induced insanity.  
Laters,
Keshik