Add an autorelease pool around the pattern renderer.
Create a cross-platform implementation of r_render_image.
Memory-checking in r_render_image.
Fix a leak.