[Mesa-dev] [PATCH 08/15] i965: check malloc return value in intel_resolve_map_set()

Juha-Pekka Heikkila juhapekka.heikkila at gmail.com
Sun Apr 27 13:05:03 PDT 2014


Signed-off-by: Juha-Pekka Heikkila <juhapekka.heikkila at gmail.com>
---
 src/mesa/drivers/dri/i965/intel_resolve_map.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/intel_resolve_map.c b/src/mesa/drivers/dri/i965/intel_resolve_map.c
index 04b5c94..c5a4cd7 100644
--- a/src/mesa/drivers/dri/i965/intel_resolve_map.c
+++ b/src/mesa/drivers/dri/i965/intel_resolve_map.c
@@ -22,6 +22,7 @@
  */
 
 #include "intel_resolve_map.h"
+#include "main/imports.h"
 
 #include <assert.h>
 #include <stdlib.h>
@@ -51,6 +52,12 @@ intel_resolve_map_set(struct intel_resolve_map *head,
    }
 
    *tail = malloc(sizeof(**tail));
+
+   if (*tail == NULL) {
+      _mesa_error_no_memory(__func__);
+      return;
+   }
+
    (*tail)->prev = prev;
    (*tail)->next = NULL;
    (*tail)->level = level;
-- 
1.8.1.2



More information about the mesa-dev mailing list