[Intel-gfx] [PATCH 06/11] xf86drmSL: Check function return value
Praveen Paneri
praveen.paneri at intel.com
Fri Apr 10 01:42:58 PDT 2015
Validate the return value of SLCreateEntry() before using it.
v2: Rebased to the latest.
Signed-off-by: Praveen Paneri <praveen.paneri at intel.com>
---
xf86drmSL.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/xf86drmSL.c b/xf86drmSL.c
index a12fa1d..42b5bc4 100644
--- a/xf86drmSL.c
+++ b/xf86drmSL.c
@@ -107,6 +107,7 @@ void *drmSLCreate(void)
list->magic = SL_LIST_MAGIC;
list->level = 0;
list->head = SLCreateEntry(SL_MAX_LEVEL, 0, NULL);
+ if (!list->head) return NULL;
list->count = 0;
for (i = 0; i <= SL_MAX_LEVEL; i++) list->head->forward[i] = NULL;
@@ -173,6 +174,7 @@ int drmSLInsert(void *l, unsigned long key, void *value)
}
entry = SLCreateEntry(level, key, value);
+ if (!entry) return -ENOMEM;
/* Fix up forward pointers */
for (i = 0; i <= level; i++) {
--
1.9.1
More information about the Intel-gfx
mailing list