summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2013-04-26 13:13:52 +0800
committerGwenole Beauchesne <gwenole.beauchesne@intel.com>2013-08-27 11:16:44 +0200
commita68b919e7c3e8449a5d3b91689f34c04fb39940c (patch)
tree16f759f665bafd2d810b2c05677586ee8f2078cc
parent72cd086b8d79e9232d229a83f77d09a54f3fff2f (diff)
downloadlibva-a68b919e7c3e8449a5d3b91689f34c04fb39940c.tar.gz
Check the device name before opening the device
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
-rw-r--r--va/x11/dri2_util.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/va/x11/dri2_util.c b/va/x11/dri2_util.c
index 0a2ac45..3d490d0 100644
--- a/va/x11/dri2_util.c
+++ b/va/x11/dri2_util.c
@@ -192,7 +192,7 @@ isDRI2Connected(VADriverContextP ctx, char **driver_name)
if (!VA_DRI2Connect(ctx->native_dpy, RootWindow(ctx->native_dpy, ctx->x11_screen),
- driver_name, &device_name))
+ driver_name, &device_name) || !device_name)
goto err_out;
dri_state->base.fd = open(device_name, O_RDWR);
@@ -216,8 +216,7 @@ isDRI2Connected(VADriverContextP ctx, char **driver_name)
dri_state->close = dri2Close;
gsDRI2SwapAvailable = (minor >= 2);
- if (device_name)
- Xfree(device_name);
+ Xfree(device_name);
return True;