On Tue, Apr 21, 2015 at 7:21 PM, Luca Barbato <[email protected]> wrote: > On 21/04/15 19:10, Vittorio Giovara wrote: >> avcodec_get_context_defaults3 may allocate memory, so free the context >> using the proper avcodec_free_context() function. >> --- >> libavcodec/options.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/libavcodec/options.c b/libavcodec/options.c >> index c00dca0..8ff7b91 100644 >> --- a/libavcodec/options.c >> +++ b/libavcodec/options.c >> @@ -131,7 +131,7 @@ AVCodecContext *avcodec_alloc_context3(const AVCodec >> *codec) >> return NULL; >> >> if(avcodec_get_context_defaults3(avctx, codec) < 0){ >> - av_free(avctx); >> + avcodec_free_context(&avctx); >> return NULL; >> } >> >> > > Probably ok, did you check what get_context_default3 does?
Yes although upon rereading it allocates memory only when codec is set, which is not the case in that codepath. So let's just drop this for now. -- Vittorio _______________________________________________ libav-devel mailing list [email protected] https://lists.libav.org/mailman/listinfo/libav-devel
