[FFmpeg-devel] [PATCH] lavd/caca: create display *after* checking dither options
Paul B Mahol
onemda at gmail.com
Sat Jul 21 18:17:31 CEST 2012
On 7/21/12, Stefano Sabatini <stefasab at gmail.com> wrote:
> Avoid fastidious creation and immediate destroy of the display in case
> one of the dither options fails to be set.
>
> Also add NULL checks in write_trailer(), which are now necessary since
> the function can be called when not all the components have been
> initialized.
> ---
> libavdevice/caca.c | 38 +++++++++++++++++++++-----------------
> 1 files changed, 21 insertions(+), 17 deletions(-)
>
> diff --git a/libavdevice/caca.c b/libavdevice/caca.c
> index 15c4b4e..0d0ed42 100644
> --- a/libavdevice/caca.c
> +++ b/libavdevice/caca.c
> @@ -47,9 +47,12 @@ static int caca_write_trailer(AVFormatContext *s)
>
> av_freep(&c->window_title);
>
> - caca_free_dither(c->dither);
> - caca_free_display(c->display);
> - caca_free_canvas(c->canvas);
> + if (c->display)
> + caca_free_display(c->display);
> + if (c->dither)
> + caca_free_dither(c->dither);
> + if (c->canvas)
> + caca_free_canvas(c->canvas);
> return 0;
> }
Those needs to be set back to NULL.
More information about the ffmpeg-devel
mailing list