summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2014-12-17 15:19:41 +0100
committerVittorio Giovara <vittorio.giovara@gmail.com>2014-12-18 23:27:14 +0100
commit9e06327ecb8f73c7904d10af7ad339c57cdaa788 (patch)
tree0c68bf81f03dc99817bb1733f7a6a2e5a749b414
parent5ac06633cb63fcc51f2471a3478b44d3f010b16b (diff)
downloadffmpeg-9e06327ecb8f73c7904d10af7ad339c57cdaa788.tar.gz
xcbgrab: Move NULL check before pointer dereference
Bug-Id: CID 1254668
-rw-r--r--libavdevice/xcbgrab.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index 243ece4b1d..161bd03281 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -99,12 +99,16 @@ static int xcbgrab_reposition(AVFormatContext *s,
xcb_get_geometry_reply_t *geo)
{
XCBGrabContext *c = s->priv_data;
- int x = c->x, y = c->y, p_x = p->win_x, p_y = p->win_y;
+ int x = c->x, y = c->y;
int w = c->width, h = c->height, f = c->follow_mouse;
+ int p_x, p_y;
if (!p || !geo)
return AVERROR(EIO);
+ p_x = p->win_x;
+ p_y = p->win_y;
+
if (f == FOLLOW_CENTER) {
x = p_x - w / 2;
y = p_y - h / 2;