mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-24 13:56:33 +02:00
xcbgrab: Free the host string after checking the connection
Prevent an use after free in the error message. Bug-Id: CID 1274040 CC: libav-stable@libav.org
This commit is contained in:
parent
0025f7408a
commit
5f5b78aca3
@ -607,14 +607,17 @@ static av_cold int xcbgrab_read_header(AVFormatContext *s)
|
|||||||
|
|
||||||
c->conn = xcb_connect(host, &screen_num);
|
c->conn = xcb_connect(host, &screen_num);
|
||||||
|
|
||||||
if (opts)
|
|
||||||
av_free(host);
|
|
||||||
|
|
||||||
if ((ret = xcb_connection_has_error(c->conn))) {
|
if ((ret = xcb_connection_has_error(c->conn))) {
|
||||||
av_log(s, AV_LOG_ERROR, "Cannot open display %s, error %d.\n",
|
av_log(s, AV_LOG_ERROR, "Cannot open display %s, error %d.\n",
|
||||||
s->filename[0] ? host : "default", ret);
|
s->filename[0] ? host : "default", ret);
|
||||||
|
if (opts)
|
||||||
|
av_freep(&host);
|
||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (opts)
|
||||||
|
av_freep(&host);
|
||||||
|
|
||||||
setup = xcb_get_setup(c->conn);
|
setup = xcb_get_setup(c->conn);
|
||||||
|
|
||||||
c->screen = get_screen(setup, screen_num);
|
c->screen = get_screen(setup, screen_num);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user