2019-03-11 9:49 GMT+01:00, Moritz Barsnick <barsn...@gmx.net>: > On Mon, Mar 11, 2019 at 04:17:21 +0000, Sun, Jing A wrote: >> From: ffmpeg-devel [mailto:ffmpeg-devel-boun...@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#ga0cc84043ea2167ad005c86e11d0bcdba > > 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 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel