gallium: new sanity assertions in mmAllocMem()
authorBrian Paul <brian.paul@tungstengraphics.com>
Wed, 29 Oct 2008 23:02:56 +0000 (17:02 -0600)
committerBrian Paul <brian.paul@tungstengraphics.com>
Wed, 29 Oct 2008 23:02:56 +0000 (17:02 -0600)
src/gallium/auxiliary/util/u_mm.c

index 0f51dd59777b7c0184fc2d825245caee99f4333b..01dd67c810b1c5f54c5e6f106b03e710bb388086 100644 (file)
@@ -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;