Fixed memory leak in joystick code