From 522190f9918206608b06bbc0bdc9271df94aa8bc Mon Sep 17 00:00:00 2001 From: "Xiang, Haihao" Date: Fri, 15 Mar 2013 15:19:49 +0800 Subject: Check the pointer is NULL or not Signed-off-by: Xiang, Haihao --- src/gen75_vpp_gpe.c | 15 +++++++++++++++ src/i965_encoder_utils.c | 3 +++ 2 files changed, 18 insertions(+) diff --git a/src/gen75_vpp_gpe.c b/src/gen75_vpp_gpe.c index fb7eba6..70f229b 100644 --- a/src/gen75_vpp_gpe.c +++ b/src/gen75_vpp_gpe.c @@ -403,6 +403,11 @@ gen75_gpe_process_sharpening(VADriverContextP ctx, vpp_gpe_ctx->thread_param = (unsigned char*) malloc(vpp_gpe_ctx->thread_param_size *vpp_gpe_ctx->thread_num); pos = vpp_gpe_ctx->thread_param; + + if (!pos) { + return VA_STATUS_ERROR_ALLOCATION_FAILED; + } + for( i = 0 ; i < vpp_gpe_ctx->thread_num; i++){ thr_param.base.v_pos = 16 * i; thr_param.base.h_pos = 0; @@ -425,6 +430,11 @@ gen75_gpe_process_sharpening(VADriverContextP ctx, vpp_gpe_ctx->thread_param = (unsigned char*) malloc(vpp_gpe_ctx->thread_param_size *vpp_gpe_ctx->thread_num); pos = vpp_gpe_ctx->thread_param; + + if (!pos) { + return VA_STATUS_ERROR_ALLOCATION_FAILED; + } + for( i = 0 ; i < vpp_gpe_ctx->thread_num; i++){ thr_param.base.v_pos = 0; thr_param.base.h_pos = 16 * i; @@ -448,6 +458,11 @@ gen75_gpe_process_sharpening(VADriverContextP ctx, vpp_gpe_ctx->thread_param = (unsigned char*) malloc(vpp_gpe_ctx->thread_param_size *vpp_gpe_ctx->thread_num); pos = vpp_gpe_ctx->thread_param; + + if (!pos) { + return VA_STATUS_ERROR_ALLOCATION_FAILED; + } + for( i = 0 ; i < vpp_gpe_ctx->thread_num; i++){ thr_param.base.v_pos = 4 * i; thr_param.base.h_pos = 0; diff --git a/src/i965_encoder_utils.c b/src/i965_encoder_utils.c index e4fe220..7f6f768 100644 --- a/src/i965_encoder_utils.c +++ b/src/i965_encoder_utils.c @@ -126,6 +126,9 @@ avc_bitstream_put_ui(avc_bitstream *bs, unsigned int val, int size_in_bits) if (pos + 1 == bs->max_size_in_dword) { bs->max_size_in_dword += BITSTREAM_ALLOCATE_STEPPING; bs->buffer = realloc(bs->buffer, bs->max_size_in_dword * sizeof(unsigned int)); + + if (!bs->buffer) + return; } bs->buffer[pos + 1] = val; -- cgit v1.2.3