fixed memory leak in capture_preview