Removed memory bug where cvEncodeImage was leaking memory