[FFmpeg-devel] [PATCH v1 1/4] avformat/dashenc: remove unused check of avformat_free_context
Jeyapal, Karthick
kjeyapal at akamai.com
Fri Nov 29 07:39:44 EET 2019
On 11/29/19 11:08 AM, Steven Liu wrote:
>
>
>> 在 2019年11月29日,13:35,Jeyapal, Karthick <kjeyapal at akamai.com> 写道:
>>
>>
>> On 11/29/19 10:45 AM, Steven Liu wrote:
>>> Signed-off-by: Steven Liu <lq at chinaffmpeg.org>
>>> ---
>>> libavformat/dashenc.c | 3 +--
>>> 1 file changed, 1 insertion(+), 2 deletions(-)
>>>
>>> diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c
>>> index a462876c13..8c28fb6b6e 100644
>>> --- a/libavformat/dashenc.c
>>> +++ b/libavformat/dashenc.c
>>> @@ -588,8 +588,7 @@ static void dash_free(AVFormatContext *s)
>>> avio_close(os->ctx->pb);
>>> }
>>> ff_format_io_close(s, &os->out);
>>> - if (os->ctx)
>>> - avformat_free_context(os->ctx);
>>> + avformat_free_context(os->ctx);
>> This 'if' condition is a safety net against double frees caused due to any corner case and/or wrong usage.
>> Unless this is absolutely required for some reason, this 'if' condition should not be removed.
>
>
> 4433 void avformat_free_context(AVFormatContext *s)
> 4434 {
> 4435 int i;
> 4436
> 4437 if (!s)
> 4438 return;
>
> This check is in the function of avformat_free_context.
Great! Then it is fine. You can remove it.
>
>>> for (j = 0; j < os->nb_segments; j++)
>>> av_free(os->segments[j]);
>>> av_free(os->segments);
>>
>
> Thanks
> Steven
>
>
>
>
>
More information about the ffmpeg-devel
mailing list