eliminated use of goto in several examples

In several examples goto was used to handle cleanup of objects.
This is similar to what is done in Linux device drivers.
However, it was decided that goto should be avoided.
Even if it works it is not the best form.