fix realloc usage and increase user data capacity
This commit is contained in:
parent
c3e023f9ee
commit
0840549568
|
@ -76,10 +76,14 @@ BOOL __stdcall wine_bass_user_data_add_ex(DWORD key, DWORD altKey, void *val) {
|
||||||
WINE_BASS_DATA_STORAGE.data = malloc(64 * sizeof(UserDataEntry));
|
WINE_BASS_DATA_STORAGE.data = malloc(64 * sizeof(UserDataEntry));
|
||||||
WINE_BASS_DATA_STORAGE.capacity = 64;
|
WINE_BASS_DATA_STORAGE.capacity = 64;
|
||||||
} else {
|
} else {
|
||||||
WINE_BASS_DATA_STORAGE.data = realloc(WINE_BASS_DATA_STORAGE.data, 2 * WINE_BASS_DATA_STORAGE.capacity * sizeof(UserDataEntry));
|
void *new = realloc(WINE_BASS_DATA_STORAGE.data, 2 * WINE_BASS_DATA_STORAGE.capacity * sizeof(UserDataEntry));
|
||||||
|
if (new) {
|
||||||
|
WINE_BASS_DATA_STORAGE.data = new;
|
||||||
|
WINE_BASS_DATA_STORAGE.capacity *= 2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!WINE_BASS_DATA_STORAGE.data) {
|
if (!WINE_BASS_DATA_STORAGE.data || WINE_BASS_DATA_STORAGE.count == WINE_BASS_DATA_STORAGE.capacity) {
|
||||||
goto CLEANUP;
|
goto CLEANUP;
|
||||||
}
|
}
|
||||||
UserDataEntry entry = {
|
UserDataEntry entry = {
|
||||||
|
|
Loading…
Reference in a new issue