From 58dc36b3c883fd460199cedb6d30e58eba58298c Mon Sep 17 00:00:00 2001 From: akallabeth Date: Thu, 2 Apr 2020 10:33:44 +0200 Subject: [PATCH] Fixed possible NULL dereference --- libfreerdp/cache/bitmap.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/libfreerdp/cache/bitmap.c b/libfreerdp/cache/bitmap.c index 13bad4d5e..058fd3a1a 100644 --- a/libfreerdp/cache/bitmap.c +++ b/libfreerdp/cache/bitmap.c @@ -281,11 +281,12 @@ rdpBitmapCache* bitmap_cache_new(rdpSettings* settings) bitmapCache->settings = settings; bitmapCache->update = ((freerdp*)settings->instance)->update; bitmapCache->context = bitmapCache->update->context; - bitmapCache->maxCells = settings->BitmapCacheV2NumCells; - bitmapCache->cells = (BITMAP_V2_CELL*)calloc(bitmapCache->maxCells, sizeof(BITMAP_V2_CELL)); + bitmapCache->cells = + (BITMAP_V2_CELL*)calloc(settings->BitmapCacheV2NumCells, sizeof(BITMAP_V2_CELL)); if (!bitmapCache->cells) goto fail; + bitmapCache->maxCells = settings->BitmapCacheV2NumCells; for (i = 0; i < (int)bitmapCache->maxCells; i++) {