Initialise scandir argument

'scandir' does not initialise 'entries' on error
This commit is contained in:
Mathieu Eyraud 2022-04-12 10:04:05 +02:00 committed by Ryan C. Gordon
parent 68b6fff245
commit 99ae6395b1
1 changed files with 2 additions and 2 deletions

View File

@ -610,7 +610,7 @@ static int get_event_joystick_index(int event)
{
int joystick_index = -1;
int i, count;
struct dirent **entries;
struct dirent **entries = NULL;
char path[PATH_MAX];
SDL_snprintf(path, SDL_arraysize(path), "/sys/class/input/event%d/device", event);
@ -679,7 +679,7 @@ LINUX_FallbackJoystickDetect(void)
/* Opening input devices can generate synchronous device I/O, so avoid it if we can */
if (stat("/dev/input", &sb) == 0 && sb.st_mtime != last_input_dir_mtime) {
int i, count;
struct dirent **entries;
struct dirent **entries = NULL;
char path[PATH_MAX];
count = scandir("/dev/input", &entries, filter_entries, sort_entries);