Zero out haptic linked list items on creation

(thanks to Turo Lamminen for the report!)
This commit is contained in:
Gabriel Jacobo
2014-02-24 10:25:02 -03:00
parent 684673dff4
commit 08e6695494
3 changed files with 4 additions and 7 deletions

View File

@@ -282,11 +282,11 @@ MaybeAddDevice(const char *path)
return -1;
}
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 -1;
}
SDL_zerop(item);
item->fname = SDL_strdup(path);
if ( (item->fname == NULL) ) {
SDL_free(item->fname);