Commit c7eb557d8955f28647ee04b3adb6b5c4036750cd

RALOVICH, Kristof 2020-07-20T10:09:07

kmsdrm: do not leak drmModeConnector Previously conn was leaked on the success path (when available was set to SDL_TRUE).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index 60d014c..75bc964 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -77,10 +77,12 @@ check_modesetting(int devindex)
 
                         if (conn->connection == DRM_MODE_CONNECTED && conn->count_modes) {
                             available = SDL_TRUE;
-                            break;
                         }
 
                         KMSDRM_drmModeFreeConnector(conn);
+                        if (available) {
+                            break;
+                        }
                     }
                 }
                 KMSDRM_drmModeFreeResources(resources);