From 08ae790497e86678be732693d4c60e8dc64e619e Mon Sep 17 00:00:00 2001
From: Cameron Cawley <[EMAIL REDACTED]>
Date: Tue, 14 Sep 2021 20:38:03 +0100
Subject: [PATCH] Replace calls to asprintf with SDL_asprintf
---
src/core/freebsd/SDL_evdev_kbd_freebsd.c | 4 ++--
src/joystick/bsd/SDL_bsdjoystick.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/core/freebsd/SDL_evdev_kbd_freebsd.c b/src/core/freebsd/SDL_evdev_kbd_freebsd.c
index 24910355e6..06642b507f 100644
--- a/src/core/freebsd/SDL_evdev_kbd_freebsd.c
+++ b/src/core/freebsd/SDL_evdev_kbd_freebsd.c
@@ -273,7 +273,7 @@ SDL_EVDEV_kbd_init(void)
* Ensures that the keystrokes do not leak through to the console.
*/
ioctl(kbd->console_fd, CONS_RELKBD, 1ul);
- asprintf(&devicePath, "/dev/kbd%d", kbd->kbInfo->kb_index);
+ SDL_asprintf(&devicePath, "/dev/kbd%d", kbd->kbInfo->kb_index);
kbd->keyboard_fd = open(devicePath, O_WRONLY | O_CLOEXEC);
if (kbd->keyboard_fd == -1)
{
@@ -288,7 +288,7 @@ SDL_EVDEV_kbd_init(void)
if (!SDL_GetHintBoolean(SDL_HINT_NO_SIGNAL_HANDLERS, SDL_FALSE)) {
kbd_register_emerg_cleanup(kbd);
}
- free(devicePath);
+ SDL_free(devicePath);
}
else kbd->keyboard_fd = kbd->console_fd;
}
diff --git a/src/joystick/bsd/SDL_bsdjoystick.c b/src/joystick/bsd/SDL_bsdjoystick.c
index e0bf2a1a16..c0fa3950de 100644
--- a/src/joystick/bsd/SDL_bsdjoystick.c
+++ b/src/joystick/bsd/SDL_bsdjoystick.c
@@ -426,7 +426,7 @@ BSD_JoystickOpen(SDL_Joystick *joy, int device_index)
str[i] = UGETW(usd.usd_desc.bString[i]);
}
str[i] = '\0';
- asprintf(&new_name, "%s @ %s", str, path);
+ SDL_asprintf(&new_name, "%s @ %s", str, path);
if (new_name != NULL) {
SDL_free(joydevnames[numjoysticks]);
joydevnames[numjoysticks] = new_name;