SDL: Initialise scandir argument

From 99ae6395b10fd72854896b17d8c7d2fe53daad7e Mon Sep 17 00:00:00 2001
From: Mathieu Eyraud <[EMAIL REDACTED]>
Date: Tue, 12 Apr 2022 10:04:05 +0200
Subject: [PATCH] Initialise scandir argument

'scandir' does not initialise 'entries' on error
---
 src/joystick/linux/SDL_sysjoystick.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/joystick/linux/SDL_sysjoystick.c b/src/joystick/linux/SDL_sysjoystick.c
index b8cac5f0f81..07cacfbb870 100644
--- a/src/joystick/linux/SDL_sysjoystick.c
+++ b/src/joystick/linux/SDL_sysjoystick.c
@@ -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);