Author: bonefish Date: 2011-01-08 20:11:35 +0100 (Sat, 08 Jan 2011) New Revision: 40161 Changeset: http://dev.haiku-os.org/changeset/40161 Modified: haiku/branches/developer/bonefish/signals/headers/private/kernel/util/OpenHashTable.h Log: _Resize(): * Renamed oldTable parameter to _oldTable. * Also set _oldTable, if we didn't have an table array yet. Fixes the Resize() behavior in this case. If the caller didn't initialize the storage to NULL, a random address could have been passed to free(). Probably never happened, since in all cases I can think of the table is allocated after construction anyway. Modified: haiku/branches/developer/bonefish/signals/headers/private/kernel/util/OpenHashTable.h =================================================================== --- haiku/branches/developer/bonefish/signals/headers/private/kernel/util/OpenHashTable.h 2011-01-08 18:44:04 UTC (rev 40160) +++ haiku/branches/developer/bonefish/signals/headers/private/kernel/util/OpenHashTable.h 2011-01-08 19:11:35 UTC (rev 40161) @@ -401,7 +401,7 @@ return true; } - void _Resize(ValueType** newTable, size_t newSize, void** oldTable = NULL) + void _Resize(ValueType** newTable, size_t newSize, void** _oldTable = NULL) { for (size_t i = 0; i < newSize; i++) newTable[i] = NULL; @@ -416,11 +416,12 @@ } } - if (oldTable != NULL) - *oldTable = fTable; + if (_oldTable != NULL) + *_oldTable = fTable; else fAllocator.Free(fTable); - } + } else if (_oldTable != NULL) + *_oldTable = NULL; fTableSize = newSize; fTable = newTable;