Fixed the leaks in poll_target and select_passive_target

Hello! I have been using this wrapper for a few small things here and there and I found that the two mentioned functions are actually leaking. 
The fix is actually quite easy. I have tested it and it removes all the leaks I cloud find.

Cheers!