Capture API: fixed possible resource leak warning