Quoting Luca Barbato (2015-03-05 09:47:07)
> Prevent an use after free in the error message.
> 
> Bug-Id: CID 1274040
> CC: [email protected]
> ---
> 
> Might be useful having coverity run on oracle ^^;
> 
>  libavdevice/xcbgrab.c | 9 ++++++---
>  1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
> index c4db983..9dc76f1 100644
> --- a/libavdevice/xcbgrab.c
> +++ b/libavdevice/xcbgrab.c
> @@ -607,14 +607,17 @@ static av_cold int xcbgrab_read_header(AVFormatContext 
> *s)
> 
>      c->conn = xcb_connect(host, &screen_num);
> 
> -    if (opts)
> -        av_free(host);
> -
>      if ((ret = xcb_connection_has_error(c->conn))) {
>          av_log(s, AV_LOG_ERROR, "Cannot open display %s, error %d.\n",
>                 s->filename[0] ? host : "default", ret);
> +        if (opts)
> +            av_free(host);
>          return AVERROR(EIO);
>      }
> +
> +    if (opts)
> +        av_free(host);

Make it av_freep() while at it.

-- 
Anton Khirnov
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to