From f3780ae8b2dcd5ae3b30bb9c4ffc36cbac58f3fe Mon Sep 17 00:00:00 2001 From: Alex Smith Date: Sat, 18 Aug 2012 12:24:09 +0100 Subject: [PATCH] CID 715700, 715701: Fixed assumption of 4 byte pointer size. --- src/add-ons/translators/gif/SFHash.cpp | 2 +- src/add-ons/translators/gif/SavePalette.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/add-ons/translators/gif/SFHash.cpp b/src/add-ons/translators/gif/SFHash.cpp index 005c156f02..e2a4586cbb 100644 --- a/src/add-ons/translators/gif/SFHash.cpp +++ b/src/add-ons/translators/gif/SFHash.cpp @@ -23,7 +23,7 @@ SFHash::SFHash(int size) { fatalerror = false; this->size = size; iterate_pos = iterate_depth = 0; - main_array = (HashItem **)malloc(this->size * 4); + main_array = (HashItem **)malloc(this->size * sizeof(HashItem *)); if (main_array == NULL) { fatalerror = true; diff --git a/src/add-ons/translators/gif/SavePalette.cpp b/src/add-ons/translators/gif/SavePalette.cpp index 82ab952f67..eb1ffb1284 100644 --- a/src/add-ons/translators/gif/SavePalette.cpp +++ b/src/add-ons/translators/gif/SavePalette.cpp @@ -324,7 +324,7 @@ SavePalette::SavePalette(BBitmap *bitmap, int32 maxSizeInBits) fSizeInBits++; fSize = 1 << fSizeInBits; - ColorItem **topcolors = (ColorItem **)malloc(fSize * 4); + ColorItem **topcolors = (ColorItem **)malloc(fSize * sizeof(ColorItem *)); if (topcolors == NULL) { if (debug) printf("Out of memory in SavePalette(BBitmap *)\n"); fFatalError = true;