Commit dd68eb5c01fe0ac7bb69d334d3790ac30e36b42a

antonino 2022-08-24T17:57:52

free drm prop before returning

diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index ebeb087..127743a 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;
 }