Fix memory leak when breaking out of a for-in loop

Use an autoreleased NSMutableArray rather than id[] to keep the objects alive so that they eventually get deleted if the caller breaks out of the loop.

@alazier @jpsim 
Nothing's being autoreleased in this version (since things aren't being returned from a C function), but I wouldn't be opposed to doing it for consistency and paranoia if there's no speed hit.