diff --git a/src/video/x11/SDL_x11pen.c b/src/video/x11/SDL_x11pen.c index c7e4c8bba6..f63654542f 100644 --- a/src/video/x11/SDL_x11pen.c +++ b/src/video/x11/SDL_x11pen.c @@ -81,10 +81,12 @@ static bool X11_XInput2PenIsEraser(SDL_VideoDevice *_this, int deviceid, char *d } if (tooltype_name) { - if (0 == SDL_strcasecmp(tooltype_name, PEN_ERASER_NAME_TAG)) { + if (SDL_strcasecmp(tooltype_name, PEN_ERASER_NAME_TAG) == 0) { result = true; } - X11_XFree(tooltype_name_info); + if (tooltype_name != (char *)tooltype_name_info) { + X11_XFree(tooltype_name_info); + } X11_XFree(tooltype_name); return result;