Fixed memory leak in cvWriteFrame