Zero out haptic linked list items on creation
(thanks to Turo Lamminen for the report!)
This commit is contained in:
parent
ac487a8eec
commit
9faed54ab1
3 changed files with 4 additions and 7 deletions
|
@ -253,13 +253,11 @@ DirectInputHaptic_MaybeAddDevice(const DIDEVICEINSTANCE * pdidInstance)
|
|||
return -1; /* not a device we can use. */
|
||||
}
|
||||
|
||||
item = (SDL_hapticlist_item *)SDL_malloc( sizeof(SDL_hapticlist_item));
|
||||
item = (SDL_hapticlist_item *)SDL_calloc(1, sizeof(SDL_hapticlist_item));
|
||||
if (item == NULL) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
||||
SDL_zerop(item);
|
||||
|
||||
item->name = WIN_StringToUTF8(pdidInstance->tszProductName);
|
||||
if (!item->name) {
|
||||
SDL_free(item);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue