Fix exception safety.

At line no:251 node is allocated. In case of exception throw or assert , it should be deleted.