summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util/u_keymap.c
diff options
context:
space:
mode:
authorZack Rusin <zack@kde.org>2009-06-20 21:19:57 -0400
committerZack Rusin <zack@kde.org>2009-07-06 17:21:37 -0400
commit4873031e29e0e8f654f78307e6ec885e68a54d86 (patch)
treeec6469eec2588f82c2049e260dbcb5c42f0a34e1 /src/gallium/auxiliary/util/u_keymap.c
parent21cce6afb03bf9b9adfc6d8a1a446bb3ef22c7a8 (diff)
util: fix possible null pointer usage
found by the clang static analyzer
Diffstat (limited to 'src/gallium/auxiliary/util/u_keymap.c')
-rw-r--r--src/gallium/auxiliary/util/u_keymap.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/util/u_keymap.c b/src/gallium/auxiliary/util/u_keymap.c
index 3f70809efd..508a2ee063 100644
--- a/src/gallium/auxiliary/util/u_keymap.c
+++ b/src/gallium/auxiliary/util/u_keymap.c
@@ -194,6 +194,8 @@ util_keymap_insert(struct keymap *map, const void *key,
struct cso_hash_iter iter;
assert(map);
+ if (!map)
+ return FALSE;
key_hash = hash(key, map->key_size);
@@ -234,6 +236,8 @@ util_keymap_lookup(const struct keymap *map, const void *key)
struct keymap_item *item;
assert(map);
+ if (!map)
+ return NULL;
key_hash = hash(key, map->key_size);
@@ -258,6 +262,8 @@ util_keymap_remove(struct keymap *map, const void *key, void *user)
struct keymap_item *item;
assert(map);
+ if (!map)
+ return;
key_hash = hash(key, map->key_size);
@@ -267,6 +273,8 @@ util_keymap_remove(struct keymap *map, const void *key, void *user)
item = hash_table_item(iter);
assert(item);
+ if (!item)
+ return;
map->delete_func(map, item->key, item->value, user);
FREE(item->key);
FREE(item);
@@ -288,7 +296,9 @@ util_keymap_remove_all(struct keymap *map, void *user)
struct keymap_item *item;
assert(map);
-
+ if (!map)
+ return;
+
iter = cso_hash_first_node(map->cso);
while (!cso_hash_iter_is_null(iter)) {
item = (struct keymap_item *)