diff options
author | Xiang, Haihao <haihao.xiang@intel.com> | 2015-09-07 15:21:49 +0800 |
---|---|---|
committer | Xiang, Haihao <haihao.xiang@intel.com> | 2015-09-15 10:11:10 +0800 |
commit | 4e434ef89683cdd5973e3413c5bf559d48125cd1 (patch) | |
tree | e2bbc49e6f263c6484bca40aa58814f99ad6d880 /src/gen8_mfd.c | |
parent | 1f2e87864a7e59c77fa25c912e8af2ea35177c11 (diff) | |
download | libva-intel-driver-4e434ef89683cdd5973e3413c5bf559d48125cd1.tar.gz |
Check pointer returned from calloc()
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
Diffstat (limited to 'src/gen8_mfd.c')
-rw-r--r-- | src/gen8_mfd.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/gen8_mfd.c b/src/gen8_mfd.c index 2d650a35..23eaca31 100644 --- a/src/gen8_mfd.c +++ b/src/gen8_mfd.c @@ -74,6 +74,10 @@ gen8_mfd_init_avc_surface(VADriverContextP ctx, if (!gen7_avc_surface) { gen7_avc_surface = calloc(sizeof(GenAvcSurface), 1); + + if (!gen7_avc_surface) + return; + gen7_avc_surface->base.frame_store_id = -1; assert((obj_surface->size & 0x3f) == 0); obj_surface->private_data = gen7_avc_surface; @@ -1273,6 +1277,10 @@ gen8_mfd_init_vc1_surface(VADriverContextP ctx, if (!gen7_vc1_surface) { gen7_vc1_surface = calloc(sizeof(struct gen7_vc1_surface), 1); + + if (!gen7_vc1_surface) + return; + assert((obj_surface->size & 0x3f) == 0); obj_surface->private_data = gen7_vc1_surface; } @@ -3173,6 +3181,9 @@ gen8_dec_hw_context_init(VADriverContextP ctx, struct object_config *obj_config) struct gen7_mfd_context *gen7_mfd_context = calloc(1, sizeof(struct gen7_mfd_context)); int i; + if (!gen7_mfd_context) + return NULL; + gen7_mfd_context->base.destroy = gen8_mfd_context_destroy; gen7_mfd_context->base.run = gen8_mfd_decode_picture; gen7_mfd_context->base.batch = intel_batchbuffer_new(intel, I915_EXEC_RENDER, 0); |