Check the returned pointer from malloc() before using it
authorXiang, Haihao <haihao.xiang@intel.com>
Wed, 10 Jul 2013 06:16:02 +0000 (14:16 +0800)
committerXiang, Haihao <haihao.xiang@intel.com>
Wed, 10 Jul 2013 06:18:35 +0000 (14:18 +0800)
Signed-off-by: Xiang, Haihao <haihao.xiang@intel.com>
(cherry picked from commit 1caf179b1425b13cacaa421c688c6df8369668c6)

src/i965_drv_video.c

index 606e279..4097750 100755 (executable)
@@ -4291,6 +4291,9 @@ i965_QuerySurfaceAttributes(VADriverContextP ctx,
 
     attribs = malloc(I965_MAX_SURFACE_ATTRIBUTES *sizeof(*attribs));
     
+    if (attribs == NULL)
+        return VA_STATUS_ERROR_ALLOCATION_FAILED;
+
     if (IS_G4X(i965->intel.device_id)) {
         if (obj_config->profile == VAProfileMPEG2Simple ||
             obj_config->profile == VAProfileMPEG2Main) {