From 201484ff6fa5f6216696e6a77c029352b2b97e65 Mon Sep 17 00:00:00 2001
From: Sam Lantinga <[EMAIL REDACTED]>
Date: Tue, 9 Aug 2022 09:03:28 -0700
Subject: [PATCH] Don't duplicate the serial number twice if a child doesn't
set one
---
src/joystick/hidapi/SDL_hidapi_combined.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/joystick/hidapi/SDL_hidapi_combined.c b/src/joystick/hidapi/SDL_hidapi_combined.c
index 6ccbcbf482b..27da8dd6e8a 100644
--- a/src/joystick/hidapi/SDL_hidapi_combined.c
+++ b/src/joystick/hidapi/SDL_hidapi_combined.c
@@ -94,6 +94,8 @@ HIDAPI_DriverCombined_OpenJoystick(SDL_HIDAPI_Device *device, SDL_Joystick *joys
serial = new_serial;
serial_length = new_length;
}
+ SDL_free(joystick->serial);
+ joystick->serial = NULL;
}
}