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

Nicolas George george at nsup.org
Thu May 16 11:03:06 EEST 2019


Ruiling Song (12019-05-16):
> ctx is a pointer to pointer here.
> 
> Signed-off-by: Ruiling Song <ruiling.song at intel.com>
> ---
>  libavutil/tx.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libavutil/tx.c b/libavutil/tx.c
> index 934ef27c81..1690604040 100644
> --- a/libavutil/tx.c
> +++ b/libavutil/tx.c
> @@ -697,7 +697,7 @@ static int gen_mdct_exptab(AVTXContext *s, int len4, double scale)
>  
>  av_cold void av_tx_uninit(AVTXContext **ctx)
>  {

> -    if (!ctx)
> +    if (!ctx || !(*ctx))

That would protect somebody stupid enough to call av_tx_uninit(NULL)
instead of av_tx_uninit(&var). A hard crass is completely warranted in
this case. An assert would be acceptable.

>          return;
>  
>      av_free((*ctx)->pfatab);

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/a43e39cc/attachment.sig>


More information about the ffmpeg-devel mailing list