[FFmpeg-devel] [PATCH V1] lavf/matroskaenc: Fix memory leak after write trailer

Hendrik Leppkes h.leppkes at gmail.com
Thu Apr 4 16:13:46 EEST 2019

On Thu, Apr 4, 2019 at 3:05 PM Andreas Rheinhardt via ffmpeg-devel
<ffmpeg-devel at ffmpeg.org> wrote:
> And I think that this memleak in mkv_write_trailer() has a twin in
> mkv_write_packet(): Audio frames are not written directly, but rather
> put into storage in cur_audio_pkt via av_packet_ref(). But if the
> preceding audio packet was a zero size packet (but possibly with
> side-data), then the preceding packet's side data will leak at this
> point. A better solution seems to be never to store a packet whose
> buffer has size zero in cur_audio_pkt. The only use we have for such
> packets is to use them for mkv_check_new_extra_data() and that has
> already been done at this point.

That seems like a good idea.

- Hendrik

More information about the ffmpeg-devel mailing list