[FFmpeg-trac] #4819(avcodec:reopened): av_register_all() memory leak

FFmpeg trac at avcodec.org
Wed Sep 2 15:35:38 CEST 2015

#4819: av_register_all() memory leak
             Reporter:  joeallen      |                    Owner:
                 Type:  defect        |                   Status:  reopened
             Priority:  normal        |                Component:  avcodec
              Version:  unspecified   |               Resolution:
             Keywords:  libx265 leak  |               Blocked By:
             Blocking:                |  Reproduced by developer:  0
Analyzed by developer:  0             |
Changes (by rbultje):

 * status:  closed => reopened
 * resolution:  invalid =>


 So, here's what I take home from it. In AVCodec, we have an
 init_static_data callback that can allocate, well, static data, and this
 is called for each codec that implements it during avregister_all. We have
 no way of free'ing such data: we don't have avunregister_all, and we don't
 have a deinit_static_data callback in AVCodec. We need both of these, and
 that's what this ticket is for.

 Additionally, for this specific issue, libx265.c uses this
 init_static_data callback to call x265_api_get, which calls dlopen and
 leaks the local variable h
 line 332). The API docs claim that we should call x265_cleanup() to clean
 up such data, but h is still lost. This is a x265 bug: it should not leak
 the local variable h, instead it should dlclose() it in x265_cleanup.

Ticket URL: <https://trac.ffmpeg.org/ticket/4819#comment:8>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker

More information about the FFmpeg-trac mailing list