[FFmpeg-devel] [PATCH V2] avutil/tx: add check against (*ctx)

Nicolas George george at nsup.org
Thu May 16 17:31:03 EEST 2019


James Almer (12019-05-16):
> An assert is meant to detect developer errors, not user errors. Crashing
> the user's whole application because they misused the API is not really
> acceptable.
> 
> I can't find examples of such functions using asserts this way, but
> there are several uninit/free/unref functions behave like the above
> patch. See av_buffer_unref(), av_packet_free(), av_bsf_free().
> Other functions instead just don't even consider the passed argument
> could be NULL at all, like avcodec_free_context() and swr_free(), which
> while not 100% safe, is a pretty realistic expectation.
> 
> I'd say either apply this patch as is, or apply the original one sent
> last night. In both cases it will be following an existing precedent in
> the codebase.

Re-read the code more carefully, and look what the existing predecent
does. You made the same mistake as me.

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20190516/1de1cf05/attachment.sig>


More information about the ffmpeg-devel mailing list