From: Brian Paul Date: Wed, 29 Oct 2008 23:02:56 +0000 (-0600) Subject: gallium: new sanity assertions in mmAllocMem() X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=766cb95a4564c48f35b5180155ab40320a68e371;p=mesa.git gallium: new sanity assertions in mmAllocMem() --- 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;