aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--shallow.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/shallow.c b/shallow.c
index 7d5ea0cd3..4c4486ad6 100644
--- a/shallow.c
+++ b/shallow.c
@@ -368,7 +368,7 @@ static uint32_t *paint_alloc(struct paint_info *info)
unsigned nr = (info->nr_bits + 31) / 32;
unsigned size = nr * sizeof(uint32_t);
void *p;
- if (!info->pool_count || info->free + size > info->end) {
+ if (!info->pool_count || size > info->end - info->free) {
if (size > POOL_SIZE)
die("BUG: pool size too small for %d in paint_alloc()",
size);