Check the pointer against NULL
authorXiang, Haihao <haihao.xiang@intel.com>
Thu, 27 Feb 2014 06:10:24 +0000 (14:10 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Mon, 16 Jun 2014 03:53:34 +0000 (11:53 +0800)
The issue is reported by Klockwork

Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
(cherry picked from commit 80d1f89388c9cb70218cd759592d2167c8845322)

src/gen6_mfc.c

index 987fa52..21db0a7 100644 (file)
@@ -1480,6 +1480,9 @@ Bool gen6_mfc_context_init(VADriverContextP ctx, struct intel_encoder_context *e
 {
     struct gen6_mfc_context *mfc_context = calloc(1, sizeof(struct gen6_mfc_context));
 
+    if (!mfc_context)
+        return False;
+
     mfc_context->gpe_context.surface_state_binding_table.length = (SURFACE_STATE_PADDED_SIZE + sizeof(unsigned int)) * MAX_MEDIA_SURFACES_GEN6;
 
     mfc_context->gpe_context.idrt.max_entries = MAX_GPE_KERNELS;