[Ffmpeg-devel] [PATCH] from DivX, Part 13: NULL callback calls

Michael Niedermayer michaelni
Sat Dec 17 03:32:29 CET 2005


Hi

On Fri, Dec 16, 2005 at 04:03:58PM -1000, Steve Lhomme wrote:
> Some tests to avoid calling NULL callbacks.

> Index: libavcodec/imgconvert.c
> ===================================================================
> RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/imgconvert.c,v
> retrieving revision 1.58
> diff -u -r1.58 imgconvert.c
> --- libavcodec/imgconvert.c	11 Jul 2005 00:43:21 -0000	1.58
> +++ libavcodec/imgconvert.c	17 Dec 2005 01:51:48 -0000
> @@ -256,7 +256,7 @@
>      int i; 
>      
>      for (i=0; i < PIX_FMT_NB; i++)
> -         if (!strcmp(pix_fmt_info[i].name, name))
> +         if (pix_fmt_info[i].name && !strcmp(pix_fmt_info[i].name, name))

a pixel format with no name is a bug


>  	     break;
>      return i;
>  }
> Index: libavcodec/utils.c
> ===================================================================
> RCS file: /cvsroot/ffmpeg/ffmpeg/libavcodec/utils.c,v
> retrieving revision 1.162
> diff -u -r1.162 utils.c
> --- libavcodec/utils.c	2 Dec 2005 00:12:37 -0000	1.162
> +++ libavcodec/utils.c	17 Dec 2005 01:58:36 -0000
> @@ -962,7 +962,7 @@
>          return -1;
>      }
>  
> -    if (avctx->codec->close)
> +    if (avctx->codec && avctx->codec->close)
>          avctx->codec->close(avctx);

how did this become NULL here?

[...]

-- 
Michael





More information about the ffmpeg-devel mailing list