[Libva] [libva-intel-driver PATCH] Check pointer against NULL first before dereferencing it
Zhao Yakui
yakui.zhao at intel.com
Sun Sep 6 18:29:41 PDT 2015
On 09/07/2015 09:29 AM, Xiang, Haihao wrote:
> Signed-off-by: Xiang, Haihao<haihao.xiang at intel.com>
This looks good to me.
Thanks.
Yakui
> ---
> src/i965_drv_video.c | 26 +++++++++++++-------------
> 1 file changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/src/i965_drv_video.c b/src/i965_drv_video.c
> index 76fbbbd..f536dcc 100644
> --- a/src/i965_drv_video.c
> +++ b/src/i965_drv_video.c
> @@ -6354,20 +6354,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)) {
More information about the Libva
mailing list