Fix some double-frees/use-after-free

r? @frank-trampe
On Mon, 14 Jul 2014, Adrien Tétar wrote:
> you are biased against gotos in general. Braceless if blocks can be way more
> dangerous than gotos for instance (the Apple SSL is an empirical proof). A
> goto with a label placed at the end of the function cannot be anymore
> dangerous than some other code styles in use in this repo like braceless
> one-liners blocks, or the fact that we use a language that does not have

If you're worried about braceless one-liners, then you should be worried
about unindented return statements, which are dangerous for the same
reason - they make it hard to follow where control actually flows, and
easy to introduce control flow other than intended.  I've seen far too
many functions whose last lines are

return true;

return false;

and then I have to read it backwards to figure out what it actually means,
and then read it again forwards to figre out whether what it means is what
was intended.

-- 
Matthew Skala
mskala@ansuz.sooke.bc.ca                 People before principles.
http://ansuz.sooke.bc.ca/