h4tr3d / avcpp

C++ wrapper for FFmpeg
Other
429 stars 78 forks source link

Memory leak (duplicate initialization) of all `CodecContext2` derived classes #125

Closed mmomtchev closed 6 months ago

mmomtchev commented 6 months ago

This constructor calls the base constructor and then initalizes the codec context:

https://github.com/h4tr3d/avcpp/blob/c5ee87f5682610a420fe443f75a754ef913fe0a3/src/codeccontext.h#L230

Which is the exactly same operation as the base constructor:

https://github.com/h4tr3d/avcpp/blob/c5ee87f5682610a420fe443f75a754ef913fe0a3/src/codeccontext.cpp#L323

The m_raw pointer gets overwritten with a new structure and the old one is lost.

I wonder which one I should keep. Probably the base one - all shared code should be as close the root as possible.