Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#8347 closed defect (fixed)

memory leaks in apng_write_packet

Reported by: Suhwan Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: apng leak
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:
There're memory leaks in apng_write_packet()
How to reproduce:

%  ffmpeg_g -y -i $PoC -loglevel 0 tmp.apng

commit 648b422e171d5eab18f6c6fd346e4050d717b936
ffmpeg version N-95601-g648b422e17 Copyright (c) 2000-2019 the FFmpeg developers
built with clang version 6.0.0-1ubuntu2 (tags/RELEASE_600/final)
configuration: --cc=clang --cxx=clang++ --ld=clang --enable-debug

Here's Valgrind log

==816== HEAP SUMMARY:
==816==     in use at exit: 1,663 bytes in 6 blocks
==816==   total heap usage: 3,591 allocs, 3,585 frees, 5,511,380 bytes allocated
==816== 
==816== 741 (88 direct, 653 indirect) bytes in 1 blocks are definitely lost in loss record 5 of 6
==816==    at 0xA031E76: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==816==    by 0xA031F91: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==816==    by 0x59642E9: av_malloc (mem.c:87)
==816==    by 0x59642E9: av_mallocz (mem.c:238)
==816==    by 0x1CBEA8A: av_packet_alloc (avpacket.c:53)
==816==    by 0x1433654: apng_write_packet (apngenc.c:231)
==816==    by 0x181A8A4: write_packet (mux.c:754)
==816==    by 0x1821265: av_interleaved_write_frame (mux.c:1245)
==816==    by 0x4B5E3A: write_packet (ffmpeg.c:816)
==816==    by 0x4C58D5: do_video_out (ffmpeg.c:1322)
==816==    by 0x4C0F5A: reap_filters (ffmpeg.c:1505)
==816==    by 0x48D6B1: transcode_step (ffmpeg.c:4639)
==816==    by 0x48D6B1: transcode (ffmpeg.c:4683)
==816==    by 0x487DC3: main (ffmpeg.c:4885)
==816== 
==816== 890 bytes in 1 blocks are definitely lost in loss record 6 of 6
==816==    at 0xA031E76: memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==816==    by 0xA031F91: posix_memalign (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==816==    by 0x59642E9: av_malloc (mem.c:87)
==816==    by 0x59642E9: av_mallocz (mem.c:238)
==816==    by 0x1433C0D: flush_packet (apngenc.c:130)
==816==    by 0x14335F2: apng_write_packet (apngenc.c:237)
==816==    by 0x181A8A4: write_packet (mux.c:754)
==816==    by 0x1821265: av_interleaved_write_frame (mux.c:1245)
==816==    by 0x4B5E3A: write_packet (ffmpeg.c:816)
==816==    by 0x4C58D5: do_video_out (ffmpeg.c:1322)
==816==    by 0x4C0F5A: reap_filters (ffmpeg.c:1505)
==816==    by 0x48D6B1: transcode_step (ffmpeg.c:4639)
==816==    by 0x48D6B1: transcode (ffmpeg.c:4683)
==816==    by 0x487DC3: main (ffmpeg.c:4885)
==816== 
==816== LEAK SUMMARY:
==816==    definitely lost: 978 bytes in 2 blocks
==816==    indirectly lost: 653 bytes in 3 blocks
==816==      possibly lost: 0 bytes in 0 blocks
==816==    still reachable: 32 bytes in 1 blocks
==816==         suppressed: 0 bytes in 0 blocks
==816== Reachable blocks (those to which a pointer was found) are not shown.
==816== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==816== 
==816== For counts of detected and suppressed errors, rerun with: -v
==816== ERROR SUMMARY: 2 errors from 2 contexts (suppressed: 0 from 0)

Please confirm.
Thanks

Attachments (1)

PoC.avi (1.0 MB ) - added by Suhwan 3 years ago.
poc

Download all attachments as: .zip

Change History (4)

by Suhwan, 3 years ago

Attachment: PoC.avi added

poc

comment:1 by James, 3 years ago

Component: undeterminedavformat
Resolution: fixed
Status: newclosed

comment:2 by Carl Eugen Hoyos, 3 years ago

Keywords: apng added

comment:3 by Carl Eugen Hoyos, 3 years ago

Keywords: leak added
Note: See TracTickets for help on using tickets.