Comment
Comment by zyedidia
What is the recommended way to use defer to free values only on an error path (rather than all paths)? Currently I use goto for this:
With defer I think I would have to use a "success" boolean like this:
I'm not sure if this has really improved things. I do see the use-case for locks and functions that allocate/free together though.