You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-04 22:03:09 +02:00
avcodec/vorbisenc: fix leak if av_mallocz failed
In put_main_header(), av_mallocz() allocates memory to local variable buffer, buffer leaks if av_mallocz() to *out failed. Add av_free(buffer) before return error code. Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
committed by
Michael Niedermayer
parent
7d38486975
commit
40a3d35da6
@ -740,8 +740,10 @@ static int put_main_header(vorbis_enc_context *venc, uint8_t **out)
|
|||||||
|
|
||||||
len = hlens[0] + hlens[1] + hlens[2];
|
len = hlens[0] + hlens[1] + hlens[2];
|
||||||
p = *out = av_mallocz(64 + len + len/255);
|
p = *out = av_mallocz(64 + len + len/255);
|
||||||
if (!p)
|
if (!p) {
|
||||||
|
av_freep(&buffer);
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
|
|
||||||
*p++ = 2;
|
*p++ = 2;
|
||||||
p += av_xiphlacing(p, hlens[0]);
|
p += av_xiphlacing(p, hlens[0]);
|
||||||
|
Reference in New Issue
Block a user