hardware/intel/intel-driver
Révision | 1f2e87864a7e59c77fa25c912e8af2ea35177c11 (tree) |
---|---|
l'heure | 2015-09-15 11:03:10 |
Auteur | Xiang, Haihao <haihao.xiang@inte...> |
Commiter | Xiang, Haihao |
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>
@@ -6348,20 +6348,20 @@ i965_Terminate(VADriverContextP ctx) | ||
6348 | 6348 | struct i965_driver_data *i965 = i965_driver_data(ctx); |
6349 | 6349 | int i; |
6350 | 6350 | |
6351 | - if (i965->wrapper_pdrvctx) { | |
6352 | - VADriverContextP pdrvctx; | |
6353 | - pdrvctx = i965->wrapper_pdrvctx; | |
6354 | - if (pdrvctx->handle) { | |
6355 | - pdrvctx->vtable->vaTerminate(pdrvctx); | |
6356 | - dlclose(pdrvctx->handle); | |
6357 | - pdrvctx->handle = NULL; | |
6358 | - } | |
6359 | - free(pdrvctx->vtable); | |
6360 | - free(pdrvctx); | |
6361 | - i965->wrapper_pdrvctx = NULL; | |
6362 | - } | |
6363 | - | |
6364 | 6351 | if (i965) { |
6352 | + if (i965->wrapper_pdrvctx) { | |
6353 | + VADriverContextP pdrvctx; | |
6354 | + pdrvctx = i965->wrapper_pdrvctx; | |
6355 | + if (pdrvctx->handle) { | |
6356 | + pdrvctx->vtable->vaTerminate(pdrvctx); | |
6357 | + dlclose(pdrvctx->handle); | |
6358 | + pdrvctx->handle = NULL; | |
6359 | + } | |
6360 | + free(pdrvctx->vtable); | |
6361 | + free(pdrvctx); | |
6362 | + i965->wrapper_pdrvctx = NULL; | |
6363 | + } | |
6364 | + | |
6365 | 6365 | for (i = ARRAY_ELEMS(i965_sub_ops); i > 0; i--) |
6366 | 6366 | if (i965_sub_ops[i - 1].display_type == 0 || |
6367 | 6367 | i965_sub_ops[i - 1].display_type == (ctx->display_type & VA_DISPLAY_MAJOR_MASK)) { |