[FFmpeg-devel] [PATCH v7 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper.

Sun, Jing A jing.a.sun at intel.com
Mon Mar 11 11:32:22 EET 2019


-----Original Message-----
From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of Carl Eugen Hoyos
Sent: Monday, March 11, 2019 5:01 PM
To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
Subject: Re: [FFmpeg-devel] [PATCH v7 1/2] lavc/svt_hevc: add libsvt hevc encoder wrapper.

2019-03-11 9:49 GMT+01:00, Moritz Barsnick <barsnick at gmx.net>:
> On Mon, Mar 11, 2019 at 04:17:21 +0000, Sun, Jing A wrote:
>> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf 
>> Of Carl Eugen Hoyos
>> > The condition is unnecessary.
>> [SUN, Jing] If av_mallocz fails, free_buffer will be called with 
>> in_data being NULL. Checking it avoids unnecessary calling to 
>> av_freep in that case.
>
> Please read the kind documentation (and the "Note" quzoted below) or 
> the source of said function, and how other uses within ffmpeg are:
>
> https://www.ffmpeg.org/doxygen/4.1/group__lavu__mem__funcs.html#ga0cc8
> 4043ea2167ad005c86e11d0bcdba
>
>     void av_freep (void *ptr)
>     [...]
>     Note
>         *ptr = NULL is safe and leads to no action.

> In other words, av_freep() already has this check.

I believe his argumentation was that he knows but that in case of oom, he wants to avoid extra indirections.

Carl Eugen

[SUN, Jing] Modified and thanks for the review!

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel at ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel


More information about the ffmpeg-devel mailing list