[FFmpeg-trac] #2216(avcodec:new): memory leak in calling avcodec_alloc_context3 and then avcodec_copy_context
    FFmpeg 
    trac at avcodec.org
       
    Thu Jan 31 14:07:19 CET 2013
    
    
  
#2216: memory leak in calling avcodec_alloc_context3 and then avcodec_copy_context
--------------------------------+-----------------------------------
             Reporter:  vinxxe  |                    Owner:
                 Type:  defect  |                   Status:  new
             Priority:  normal  |                Component:  avcodec
              Version:  1.1.1   |               Resolution:
             Keywords:  leak    |               Blocked By:
             Blocking:          |  Reproduced by developer:  1
Analyzed by developer:  1       |
--------------------------------+-----------------------------------
Comment (by vinxxe):
 Replying to [comment:3 Cigaes]:
 > Is there a reason you are using {{{av_free}}} instead of
 {{{avcodec_close}}}?
 I did not open the codec context so there's no reason to close it, I
 presume. By the way things get unchanged even if you close the context or
 you open and close it. the leak is in between the two calls
 {{{
     DestCodecCtx = avcodec_alloc_context3(codec);
     avcodec_copy_context(DestCodecCtx,SourceCodecCtx);
 }}}
 and closing and freeing it will not avoid it, because in the call some
 memory is allocated for
 {{{DestCodecCtx->priv_data}}} and in the second call the pointer is set to
 NULL without freeing the memory previously allocated.
-- 
Ticket URL: <https://ffmpeg.org/trac/ffmpeg/ticket/2216#comment:4>
FFmpeg <http://ffmpeg.org>
FFmpeg issue tracker
    
    
More information about the FFmpeg-trac
mailing list