Fixed bug 3512 - Memory leak of SDL_Joystick axes_zero array
authorSam Lantinga <slouken@libsdl.org>
Fri, 09 Dec 2016 01:29:52 -0800
changeset 1068969d6c1c7a2bf
parent 10688 f910d0498992
child 10690 23a825f341e6
Fixed bug 3512 - Memory leak of SDL_Joystick axes_zero array

Benjamin Harris

Found with valgrind and confirmed in the 2.0.5 source code.
One-line fix in SDL_JoystickClose?
src/joystick/SDL_joystick.c
     1.1 --- a/src/joystick/SDL_joystick.c	Thu Dec 08 10:13:45 2016 -0800
     1.2 +++ b/src/joystick/SDL_joystick.c	Fri Dec 09 01:29:52 2016 -0800
     1.3 @@ -486,6 +486,7 @@
     1.4  
     1.5      /* Free the data associated with this joystick */
     1.6      SDL_free(joystick->axes);
     1.7 +    SDL_free(joystick->axes_zero);
     1.8      SDL_free(joystick->hats);
     1.9      SDL_free(joystick->balls);
    1.10      SDL_free(joystick->buttons);