We don't tend to use gotos in our code; it's probably better to just break out of the loop. In particular, I think there's a memory leak here, because your goto skips over the code where you free your temporary pool.