[FFmpeg-devel] [PATCH 1/7] doc/examples: remove unneeded NULL checks

wm4 nfxjfg at googlemail.com
Sat Aug 16 01:30:44 CEST 2014


On Sat, 16 Aug 2014 01:15:42 +0200
Michael Niedermayer <michaelni at gmx.at> wrote:

> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> ---
>  doc/examples/resampling_audio.c |    3 +--
>  doc/examples/scaling_video.c    |    3 +--
>  2 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/doc/examples/resampling_audio.c b/doc/examples/resampling_audio.c
> index 8a43b09..f35e7e1 100644
> --- a/doc/examples/resampling_audio.c
> +++ b/doc/examples/resampling_audio.c
> @@ -199,8 +199,7 @@ int main(int argc, char **argv)
>              fmt, dst_ch_layout, dst_nb_channels, dst_rate, dst_filename);
>  
>  end:
> -    if (dst_file)
> -        fclose(dst_file);
> +    fclose(dst_file);

If dst_file can be NULL, then I don't think this is safe.

>      if (src_data)
>          av_freep(&src_data[0]);
> diff --git a/doc/examples/scaling_video.c b/doc/examples/scaling_video.c
> index fcb98b7..587f3ab 100644
> --- a/doc/examples/scaling_video.c
> +++ b/doc/examples/scaling_video.c
> @@ -132,8 +132,7 @@ int main(int argc, char **argv)
>             av_get_pix_fmt_name(dst_pix_fmt), dst_w, dst_h, dst_filename);
>  
>  end:
> -    if (dst_file)
> -        fclose(dst_file);
> +    fclose(dst_file);
>      av_freep(&src_data[0]);
>      av_freep(&dst_data[0]);
>      sws_freeContext(sws_ctx);



More information about the ffmpeg-devel mailing list