shallow.c: make paint_alloc slightly more robust
[gitweb.git] / shallow.c
index 91aa59d4b82175bd14afc0eb34fa767ed39cdab1..7d5ea0cd39d13f290353e6028b11a793080c26ad 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -369,6 +369,9 @@ static uint32_t *paint_alloc(struct paint_info *info)
        unsigned size = nr * sizeof(uint32_t);
        void *p;
        if (!info->pool_count || info->free + size > info->end) {
+               if (size > POOL_SIZE)
+                       die("BUG: pool size too small for %d in paint_alloc()",
+                           size);
                info->pool_count++;
                REALLOC_ARRAY(info->pools, info->pool_count);
                info->free = xmalloc(POOL_SIZE);