id,summary,reporter,owner,description,type,status,priority,component,version,resolution,keywords,cc,blockedby,blocking,reproduced,analyzed
2216,memory leak in calling avcodec_alloc_context3 and then avcodec_copy_context,vinxxe,,"Summary of the bug:

in the documentation of the '''avcodec_copy_context''' function is clearly stated that the '''dest''' target codec context should be initialized with '''avcodec_alloc_context3'''.
If you perform this pair of calls, one after the other, the '''avcodec_alloc_context3''' will allocate some memory pointed by the '''priv_data''' field of the codec context (file '''libavcodec/options.c''', line '''128''') through the call of the '''avcodec_get_context_defaults3''' function, but the following call to the '''avcodec_copy_context''' (with '''dest''' parameter set to the newly allocated codec context) will overwrite the '''priv_data''' pointer without deallocating the memory reserved by the '''avcodec_get_context_defaults3''', so causing a memory leak.

How to reproduce:
{{{

   AVCodec  *codec;
   AVCodecContext    *SourceCodecCtx, *DestCodecCtx;

   ...

   DestCodecCtx = avcodec_alloc_context3(codec);
   avcodec_copy_context(DestCodecCtx, SourceCodecCtx);


}}}
",defect,new,normal,avcodec,1.1.1,,leak,,,,1,1
