#11332(avformat:new): ffio_open_whitelist leaks memory
#11332: ffio_open_whitelist leaks memory ----------------------------------+---------------------------------- Reporter: oarfish | Type: defect Status: new | Priority: normal Component: avformat | Version: 7.1 Keywords: leak | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ----------------------------------+---------------------------------- I suspect that ffio_open_whitelist is leaking an URLContext. In this line, a context is declared https://github.com/FFmpeg/FFmpeg/blob/7c1e732ad2e240af5afe9ffea443c91bb233aa... and then allocated by ffurl_open_whitelist at https://github.com/FFmpeg/FFmpeg/blob/7c1e732ad2e240af5afe9ffea443c91bb233aa... However, I don't see it being freed anywhere. In my program, this causes the leak sanitizer to report a leak: {{{ Indirect leak of 234 byte(s) in 1 object(s) allocated from: #0 0x7faaaa89565f in __interceptor_posix_memalign ../../../../src/libsanitizer/lsan/lsan_interceptors.cpp:110 #1 0x557e4562f3df in av_malloc libavutil/mem.c:107 #2 0x557e4562f7f3 in av_mallocz libavutil/mem.c:258 #3 0x557e458b85d0 in url_alloc_for_protocol libavformat/avio.c:139 #4 0x557e458b9271 in ffurl_alloc libavformat/avio.c:356 #5 0x557e458b92e6 in ffurl_open_whitelist libavformat/avio.c:369 #6 0x557e458b988c in ffio_open_whitelist libavformat/avio.c:480 #7 0x557e4588b767 in io_open_default libavformat/options.c:153 #8 0x557e45875a27 in init_input libavformat/demux.c:178 #9 0x557e45875d35 in avformat_open_input libavformat/demux.c:248 }}} I did not manage to reproduce this repro this yet in a minimal executable, will update once i can. -- Ticket URL: <https://trac.ffmpeg.org/ticket/11332> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#11332: ffio_open_whitelist leaks memory -------------------------------------+------------------------------------- Reporter: oarfish | Owner: (none) Type: defect | Status: closed Priority: normal | Component: avformat Version: 7.1 | Resolution: | needs_more_info Keywords: leak | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+------------------------------------- Changes (by mkver): * resolution: => needs_more_info * status: new => closed Comment: ffio_fdopen() attaches the URLContext to the AVIOContext, so it does not leak, but is kept and used after this function returns; it gets freed when the AVIOContext gets freed in avio_close() or avio_closep() which are the deallocators for AVIOContexts allocated by avio_open(), avio_open2() (and ffio_open_whitelist()). Given that libavformat allocated the AVIOContext for you, it also frees it itself, so there should be no leaks. Did you free the AVIOContext yourself manually? This would explain your leak. -- Ticket URL: <https://trac.ffmpeg.org/ticket/11332#comment:1> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
participants (1)
-
FFmpeg