summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXiang, Haihao <haihao.xiang@intel.com>2013-03-15 15:19:49 +0800
committerXiang, Haihao <haihao.xiang@intel.com>2013-03-15 15:45:28 +0800
commit522190f9918206608b06bbc0bdc9271df94aa8bc (patch)
treec4b49c0decef30e75c72dcceb5178af200311bdb
parenta38598bfb10429f2a50e7f6f907f06cb7a5c30a7 (diff)
downloadvaapi-intel-driver-522190f9918206608b06bbc0bdc9271df94aa8bc.tar.gz
vaapi-intel-driver-522190f9918206608b06bbc0bdc9271df94aa8bc.tar.bz2
vaapi-intel-driver-522190f9918206608b06bbc0bdc9271df94aa8bc.zip
Check the pointer is NULL or not
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
-rw-r--r--src/gen75_vpp_gpe.c15
-rw-r--r--src/i965_encoder_utils.c3
2 files changed, 18 insertions, 0 deletions
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;