Opened 8 days ago

#11332 new defect

ffio_open_whitelist leaks memory

Reported by: oarfish Owned by:
Priority: normal Component: avformat
Version: 7.1 Keywords: leak
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I suspect that ffio_open_whitelist is leaking an URLContext.

In this line, a context is declared
https://github.com/FFmpeg/FFmpeg/blob/7c1e732ad2e240af5afe9ffea443c91bb233aa65/libavformat/avio.c#L475

and then allocated by ffurl_open_whitelist at
https://github.com/FFmpeg/FFmpeg/blob/7c1e732ad2e240af5afe9ffea443c91bb233aa65/libavformat/avio.c#L480C11-L480C31

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.

Change History (0)

Note: See TracTickets for help on using tickets.