Opened 7 years ago
Closed 7 years ago
#7074 closed defect (fixed)
Do not use av_free() to free avcodec_alloc_context3() return value
Reported by: | PanBian | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | avcodec |
Version: | git-master | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Reproduced by developer: | no | |
Analyzed by developer: | no |
Description
Details: In avcodec_dct_init(), the return value of avcodec_alloc_context3() (called at line 90) is freed with av_free() (at line 127). I think the expected paired function is avcodec_free_context(). For your convenience, I paste related bugs as follows:
88 int avcodec_dct_init(AVDCT *dsp) 89 { 90 AVCodecContext *avctx = avcodec_alloc_context3(NULL); 91 92 if (!avctx) 93 return AVERROR(ENOMEM); 94 95 avctx->idct_algo = dsp->idct_algo; 96 avctx->dct_algo = dsp->dct_algo; 97 avctx->bits_per_raw_sample = dsp->bits_per_sample; ... 125 126 avcodec_close(avctx); 127 av_free(avctx); 128 129 return 0; 130 }
Thanks!
Change History (3)
follow-up: 2 comment:1 by , 7 years ago
comment:2 by , 7 years ago
Replying to cehoyos:
Is there a reason why you didn't send a patch - made with
git format-patch
- to the FFmpeg development mailing list?
I got a problem on compiling the source code on my machine. So I post the bug here. I will try to solve the compiling problem. I am willing to make a patch if the bug is still not fixed then.
comment:3 by , 7 years ago
Component: | undetermined → avcodec |
---|---|
Resolution: | → fixed |
Status: | new → closed |
Version: | unspecified → git-master |
Is there a reason why you didn't send a patch - made with
git format-patch
- to the FFmpeg development mailing list?