|
@@ -99,7 +99,7 @@ bool SDL_SetTLS(SDL_TLSID *id, const void *value, SDL_TLSDestructorCallback dest
|
|
|
|
|
|
|
|
oldlimit = storage ? storage->limit : 0;
|
|
oldlimit = storage ? storage->limit : 0;
|
|
|
newlimit = (storage_index + TLS_ALLOC_CHUNKSIZE);
|
|
newlimit = (storage_index + TLS_ALLOC_CHUNKSIZE);
|
|
|
- new_storage = (SDL_TLSData *)SDL_realloc(storage, sizeof(*storage) + (newlimit - 1) * sizeof(storage->array[0]));
|
|
|
|
|
|
|
+ new_storage = (SDL_TLSData *)SDL_realloc(storage, sizeof(*storage) + newlimit * sizeof(storage->array[0]));
|
|
|
if (!new_storage) {
|
|
if (!new_storage) {
|
|
|
return false;
|
|
return false;
|
|
|
}
|
|
}
|