summaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_mm.c
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2008-10-29 17:02:56 -0600
committerBrian Paul <[email protected]>2008-10-29 17:02:56 -0600
commit766cb95a4564c48f35b5180155ab40320a68e371 (patch)
tree695355e024548e2d51e37d87d33990ac339ca14d /src/gallium/auxiliary/util/u_mm.c
parent7d7f0f170692962cf57d6893428f3a18f590c060 (diff)
gallium: new sanity assertions in mmAllocMem()
Diffstat (limited to 'src/gallium/auxiliary/util/u_mm.c')
-rw-r--r--src/gallium/auxiliary/util/u_mm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/util/u_mm.c b/src/gallium/auxiliary/util/u_mm.c
index 0f51dd59777..01dd67c810b 100644
--- a/src/gallium/auxiliary/util/u_mm.c
+++ b/src/gallium/auxiliary/util/u_mm.c
@@ -172,6 +172,10 @@ mmAllocMem(struct mem_block *heap, int size, int align2, int startSearch)
int startofs = 0;
int endofs;
+ assert(size >= 0);
+ assert(align2 >= 0);
+ assert(align2 <= 12); /* sanity check, 2^12 (4KB) enough? */
+
if (!heap || align2 < 0 || size <= 0)
return NULL;