diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2015-09-07 09:29:38 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2015-09-15 10:03:10 +0800 |
commit | 1f2e87864a7e59c77fa25c912e8af2ea35177c11 (patch) | |
tree | 8f93b3c2533165bed0f52e2d8ca8ce1f406a7d0f | |
parent | 8953dbd0c8936520e69f60f5ac3cfba85d5d1daa (diff) |
Check pointer against NULL first before dereferencing it
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Reviewed-by: Zhao, Yakui <yakui.zhao@intel.com>
-rw-r--r-- | src/i965_drv_video.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c index 92e7806..1f4c322 100644 --- a/src/i965_drv_video.c +++ b/src/i965_drv_video.c @@ -6348,20 +6348,20 @@ i965_Terminate(VADriverContextP ctx) struct i965_driver_data *i965 = i965_driver_data(ctx); int i; - if (i965->wrapper_pdrvctx) { - VADriverContextP pdrvctx; - pdrvctx = i965->wrapper_pdrvctx; - if (pdrvctx->handle) { - pdrvctx->vtable->vaTerminate(pdrvctx); - dlclose(pdrvctx->handle); - pdrvctx->handle = NULL; - } - free(pdrvctx->vtable); - free(pdrvctx); - i965->wrapper_pdrvctx = NULL; - } - if (i965) { + if (i965->wrapper_pdrvctx) { + VADriverContextP pdrvctx; + pdrvctx = i965->wrapper_pdrvctx; + if (pdrvctx->handle) { + pdrvctx->vtable->vaTerminate(pdrvctx); + dlclose(pdrvctx->handle); + pdrvctx->handle = NULL; + } + free(pdrvctx->vtable); + free(pdrvctx); + i965->wrapper_pdrvctx = NULL; + } + for (i = ARRAY_ELEMS(i965_sub_ops); i > 0; i--) if (i965_sub_ops[i - 1].display_type == 0 || i965_sub_ops[i - 1].display_type == (ctx->display_type & VA_DISPLAY_MAJOR_MASK)) { |