src/joystick/bsd/SDL_sysjoystick.c
changeset 10187 1f0f8c95531d
parent 9998 f67cf37e9cd4
child 10617 346c02ff71b6
     1.1 --- a/src/joystick/bsd/SDL_sysjoystick.c	Sun Jun 26 21:08:57 2016 +0200
     1.2 +++ b/src/joystick/bsd/SDL_sysjoystick.c	Tue Jun 28 21:08:23 2016 +0200
     1.3 @@ -179,7 +179,7 @@
     1.4  
     1.5          SDL_snprintf(s, SDL_arraysize(s), "/dev/uhid%d", i);
     1.6  
     1.7 -        joynames[SDL_SYS_numjoysticks] = strdup(s);
     1.8 +        joynames[SDL_SYS_numjoysticks] = SDL_strdup(s);
     1.9  
    1.10          if (SDL_SYS_JoystickOpen(&nj, SDL_SYS_numjoysticks) == 0) {
    1.11              SDL_SYS_JoystickClose(&nj);
    1.12 @@ -193,7 +193,7 @@
    1.13          SDL_snprintf(s, SDL_arraysize(s), "/dev/joy%d", i);
    1.14          fd = open(s, O_RDONLY);
    1.15          if (fd != -1) {
    1.16 -            joynames[SDL_SYS_numjoysticks++] = strdup(s);
    1.17 +            joynames[SDL_SYS_numjoysticks++] = SDL_strdup(s);
    1.18              close(fd);
    1.19          }
    1.20      }
    1.21 @@ -304,14 +304,14 @@
    1.22      }
    1.23      joy->hwdata = hw;
    1.24      hw->fd = fd;
    1.25 -    hw->path = strdup(path);
    1.26 +    hw->path = SDL_strdup(path);
    1.27      if (!SDL_strncmp(path, "/dev/joy", 8)) {
    1.28          hw->type = BSDJOY_JOY;
    1.29          joy->naxes = 2;
    1.30          joy->nbuttons = 2;
    1.31          joy->nhats = 0;
    1.32          joy->nballs = 0;
    1.33 -        joydevnames[device_index] = strdup("Gameport joystick");
    1.34 +        joydevnames[device_index] = SDL_strdup("Gameport joystick");
    1.35          goto usbend;
    1.36      } else {
    1.37          hw->type = BSDJOY_UHID;
    1.38 @@ -363,7 +363,7 @@
    1.39          str[i] = '\0';
    1.40          asprintf(&new_name, "%s @ %s", str, path);
    1.41          if (new_name != NULL) {
    1.42 -            free(joydevnames[SDL_SYS_numjoysticks]);
    1.43 +            SDL_free(joydevnames[SDL_SYS_numjoysticks]);
    1.44              joydevnames[SDL_SYS_numjoysticks] = new_name;
    1.45          }
    1.46      }