[FFmpeg-devel] [PATCH v3] avformat/nutdec: Add check for avformat_new_stream

Jiasheng Jiang jiasheng at iscas.ac.cn
Wed Feb 23 04:14:45 EET 2022


Michael Niedermayer:
>> diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
>> index 0a8a700acf..32a4f6bbcb 100644
>> --- a/libavformat/nutdec.c
>> +++ b/libavformat/nutdec.c
>> @@ -351,8 +351,13 @@ static int decode_main_header(NUTContext *nut)
>>          ret = AVERROR(ENOMEM);
>>          goto fail;
>>      }
>> -    for (i = 0; i < stream_count; i++)
>> -        avformat_new_stream(s, NULL);
>> +    for (i = 0; i < stream_count; i++) {
>> +        if (!avformat_new_stream(s, NULL)) {
>> +            av_freep(nut->stream);
> 
> is this actually needed or isnt this freed anyway ?
> also if needed thats the wrong pointer 
> av_freep(&nut->stream)

OK, I will remove it and submit v4.

Jiang



More information about the ffmpeg-devel mailing list