[intel] Assert against 0-sized buffers in dri_bufmgr_fake.c.
authorEric Anholt <eric@anholt.net>
Fri, 16 Nov 2007 22:38:09 +0000 (14:38 -0800)
committerEric Anholt <eric@anholt.net>
Fri, 16 Nov 2007 23:36:18 +0000 (15:36 -0800)
They shouldn't be created, and this often helps catch stupid issues.

src/mesa/drivers/dri/common/dri_bufmgr_fake.c

index a18abe106214309d7c17aa7098b686596b13bc02..863484c81009cb4132912c75a396b29d18c6ba0c 100644 (file)
@@ -554,6 +554,8 @@ dri_fake_bo_alloc(dri_bufmgr *bufmgr, const char *name,
 
    bufmgr_fake = (dri_bufmgr_fake *)bufmgr;
 
+   assert(size != 0);
+
    bo_fake = calloc(1, sizeof(*bo_fake));
    if (!bo_fake)
       return NULL;
@@ -590,6 +592,8 @@ dri_fake_bo_alloc_static(dri_bufmgr *bufmgr, const char *name,
 
    bufmgr_fake = (dri_bufmgr_fake *)bufmgr;
 
+   assert(size != 0);
+
    bo_fake = calloc(1, sizeof(*bo_fake));
    if (!bo_fake)
       return NULL;