Opened 10 years ago

Closed 10 years ago

#3938 closed defect (duplicate)

avformat_find_stream_info leaks memory

Reported by: Tuukka Pasanen Owned by:
Priority: minor Component: avcodec
Version: git-master Keywords: leak
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

When using avformat_find_stream_info there is small memory leak. Allocated mutex ain't never released. This very smalla issue since memory lost is about 40 bytes. Tested with 2.2.7 and GIT same both.
Valgrind command was:

valgrind --leak-check=full --show-reachable=yes ./ffprobe /some/where/over/the/rainbow/Screenatorium_-_05_-_The_Answer_Lies.mp3

File used is from Jamendo (https://www.jamendo.com/en/list/a16574/blue-morning-ep).
Valgrind output is

==26165== Memcheck, a memory error detector
==26165== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==26165== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==26165== Command: ffprobe Screenatorium_-_05_-_The_Answer_Lies.mp3
==26165== 
ffprobe version N-66222-g1b5ccae Copyright (c) 2007-2014 the FFmpeg developers
  built on Sep 10 2014 08:52:36 with gcc 4.7 (SUSE Linux)
  configuration: --prefix=/some/where/over/the/rainbow/ffmpeg-git-install --enable-shared --disable-static --enable-debug --disable-stripping --enable-gpl --enable-x11grab --enable-version3 --enable-pthreads --enable-avfilter --enable-libpulse --enable-libvpx --enable-libopus --enable-libass --enable-libx265 --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libxvid --enable-libx264 --enable-libschroedinger --enable-libgsm --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-postproc --enable-libdc1394 --enable-librtmp --enable-libfreetype --enable-avresample --enable-libvo-aacenc --disable-indev=jack
  libavutil      54.  7.100 / 54.  7.100
  libavcodec     56.  1.100 / 56.  1.100
  libavformat    56.  4.101 / 56.  4.101
  libavdevice    56.  0.100 / 56.  0.100
  libavfilter     5.  1.100 /  5.  1.100
  libavresample   2.  1.  0 /  2.  1.  0
  libswscale      3.  0.100 /  3.  0.100
  libswresample   1.  1.100 /  1.  1.100
  libpostproc    53.  0.100 / 53.  0.100
Input #0, mp3, from 'Screenatorium_-_05_-_The_Answer_Lies.mp3':
  Metadata:
    title           : 05 - The Answer Lies
    artist          : Screenatorium
    album           : Blue Morning EP
    date            : 2007
    genre           : (255)
    publisher       : Jamendo
    copyright       : 2008-01-07T16:09:03+01:00 Screenatorium. Licensed to the public under http://creativecommons.org/licenses/by-nc-sa/3.0/ verify at http://www.jamendo.comalbum/16574/
    encoded_by      : Jamendo : http://www.jamendo.com | LAME
    TDTG            : 2012-01-12T04:49:33
  Duration: 00:04:12.03, start: 0.025056, bitrate: 194 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16p, 193 kb/s
    Metadata:
      encoder         : LAME3.98r
    Stream #0:1: Video: mjpeg, yuvj444p(pc, bt470bg), 400x400 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      title           : 
      comment         : Cover (front)
==26165== 
==26165== HEAP SUMMARY:
==26165==     in use at exit: 80 bytes in 2 blocks
==26165==   total heap usage: 1,915 allocs, 1,913 frees, 1,410,194 bytes allocated
==26165== 
==26165== 40 bytes in 1 blocks are still reachable in loss record 1 of 2
==26165==    at 0x4C29D96: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==26165==    by 0x4C29E87: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==26165==    by 0x73016A9: av_malloc (mem.c:95)
==26165==    by 0x5D19719: default_lockmgr_cb (utils.c:80)
==26165==    by 0x5D1FF9F: avpriv_lock_avformat (utils.c:3475)
==26165==    by 0x5460DA8: ff_tls_init (network.c:71)
==26165==    by 0x54B9A7E: avformat_network_init (utils.c:4036)
==26165==    by 0x405410: main (ffprobe.c:2971)
==26165== 
==26165== 40 bytes in 1 blocks are still reachable in loss record 2 of 2
==26165==    at 0x4C29D96: memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==26165==    by 0x4C29E87: posix_memalign (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==26165==    by 0x73016A9: av_malloc (mem.c:95)
==26165==    by 0x5D19719: default_lockmgr_cb (utils.c:80)
==26165==    by 0x5D1FEAD: ff_lock_avcodec (utils.c:3443)
==26165==    by 0x5D201B0: avcodec_open2 (utils.c:1305)
==26165==    by 0x54B5E5A: avformat_find_stream_info (utils.c:3014)
==26165==    by 0x40591C: main (ffprobe.c:2374)
==26165== 
==26165== LEAK SUMMARY:
==26165==    definitely lost: 0 bytes in 0 blocks
==26165==    indirectly lost: 0 bytes in 0 blocks
==26165==      possibly lost: 0 bytes in 0 blocks
==26165==    still reachable: 80 bytes in 2 blocks
==26165==         suppressed: 0 bytes in 0 blocks
==26165== 
==26165== For counts of detected and suppressed errors, rerun with: -v
==26165== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 2 from 2)

Change History (1)

comment:1 by Carl Eugen Hoyos, 10 years ago

Component: ffprobeavcodec
Resolution: duplicate
Status: newclosed

Duplicate of ticket #3194
It apparently cannot be fixed, at least not easily.

Note: See TracTickets for help on using tickets.