[FFmpeg-trac] #5714(avformat:new): Memory leak using AVStream
FFmpeg
trac at avcodec.org
Fri Jul 15 14:50:19 EEST 2016
#5714: Memory leak using AVStream
----------------------------------+--------------------------------------
Reporter: nguydavi | Type: defect
Status: new | Priority: important
Component: avformat | Version: git-master
Keywords: leak | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
----------------------------------+--------------------------------------
Hi,
I am upgrading from FFmpeg 2.8.4 to 3.1.1, and changing code to not use
AVStream.codec anymore. By doing so, I get a memory leak with valgrind,
here's the trace
==15481== at 0x4A07306: memalign (vg_replace_malloc.c:532)
==15481== by 0x4A0735F: posix_memalign (vg_replace_malloc.c:660)
==15481== by 0x6EA3E48: av_malloc (mem.c:97)
==15481== by 0x6EA4165: av_mallocz (mem.c:254)
==15481== by 0x599D3E8: init_context_defaults (options.c:127)
==15481== by 0x599D540: avcodec_alloc_context3 (options.c:163)
==15481== by 0x6BDED26: avformat_new_stream (utils.c:4098)
Seems like AVCodecContext.priv_data is not being freed.
Looking at the code, the AVStream.codec is still being allocated by you
and
freed here
https://www.ffmpeg.org/doxygen/3.1/libavformat_2utils_8c_source.html at
line 3980.
I tested adding avcodec_close(st->codec) before av_freep(&st->codec) and
the leak is gone.
I used to close st->codec myself before this deprecation.
Did I misused the new AVStream and forgot to call a new method that should
free that ?
--
Ticket URL: <https://trac.ffmpeg.org/ticket/5714>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list