From dd68eb5c01fe0ac7bb69d334d3790ac30e36b42a Mon Sep 17 00:00:00 2001 From: antonino Date: Wed, 24 Aug 2022 17:57:52 +0200 Subject: [PATCH] free drm prop before returning --- src/video/kmsdrm/SDL_kmsdrmvideo.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c index ebeb087e2..127743aff 100644 --- a/src/video/kmsdrm/SDL_kmsdrmvideo.c +++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c @@ -629,8 +629,9 @@ KMSDRM_CrtcSetVrr(uint32_t drm_fd, uint32_t crtc_id, SDL_bool enabled) static SDL_bool KMSDRM_CrtcGetVrr(uint32_t drm_fd, uint32_t crtc_id) { - uint32_t vrr_prop_id; + uint32_t object_prop_id, vrr_prop_id; drmModeObjectPropertiesPtr props; + SDL_bool object_prop_value; int i; if (!KMSDRM_VrrPropId(drm_fd, crtc_id, &vrr_prop_id)) @@ -650,11 +651,14 @@ KMSDRM_CrtcGetVrr(uint32_t drm_fd, uint32_t crtc_id) if (!drm_prop) continue; - if(drm_prop->prop_id == vrr_prop_id) { - return props->prop_values[i] ? SDL_TRUE: SDL_FALSE; - } + object_prop_id = drm_prop->prop_id; + object_prop_value = props->prop_values[i] ? SDL_TRUE: SDL_FALSE; KMSDRM_drmModeFreeProperty(drm_prop); + + if(object_prop_id == vrr_prop_id) { + return object_prop_value; + } } return SDL_FALSE; }