video capture memory leak fix