Added a temporary buffer to prevent losing the pointer to the cloned buffer when dcb->func.write fails.