[FFmpeg-cvslog] xcbgrab: Free the host string after checking the connection
Luca Barbato
git at videolan.org
Sun Mar 8 19:54:09 CET 2015
ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Thu Mar 5 09:44:55 2015 +0100| [5f5b78aca35d07c771f5c4c73a984be9fe04a0b8] | committer: Luca Barbato
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 at libav.org
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5f5b78aca35d07c771f5c4c73a984be9fe04a0b8
---
libavdevice/xcbgrab.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index c4db983..20a29d1 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_freep(&host);
return AVERROR(EIO);
}
+
+ if (opts)
+ av_freep(&host);
+
setup = xcb_get_setup(c->conn);
c->screen = get_screen(setup, screen_num);
More information about the ffmpeg-cvslog
mailing list