[FFmpeg-trac] #3194(avcodec:open): valgrind leak on example package (leaking global lock manager mutex at exit)
FFmpeg
trac at avcodec.org
Fri Jan 22 09:50:15 CET 2016
#3194: valgrind leak on example package (leaking global lock manager mutex at
exit)
-------------------------------------+-------------------------------------
Reporter: andreyv | Owner:
Type: defect | er.anshul.maheshwari@…
Priority: minor | Status: open
Version: git-master | Component: avcodec
Keywords: leak | Resolution:
Blocking: | Blocked By:
Analyzed by developer: 1 | Reproduced by developer: 1
-------------------------------------+-------------------------------------
Comment (by jyavenard):
Why wasn't the codec_mutex not allocated on the stack instead ?
The test that the codec_mutex has been allocated isn't thread-safe itself.
(testing that a pointer isn't null isn't an atomic operation, and the
behaviour is undefined in C or C++)
https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/utils.c#L76
{{{
if (!*mutex) {
pthread_mutex_t *tmp = av_malloc(sizeof(pthread_mutex_t));
if (!tmp)
return AVERROR(ENOMEM);
}}}
so I don't see much the advantage in allocating codec_mutex on the stack ;
and would get around valgrind reporting this has a leak.
(I'm facing the same problem on our mozilla's ASAN build which has
suddenly started to report failures to this 40 bytes (size of
pthread_mutex_t on Linux 64 bits) object leaking)
--
Ticket URL: <https://trac.ffmpeg.org/ticket/3194#comment:16>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list