kmsdrm: do not leak drmModeConnector Previously conn was leaked on the success path (when available was set to SDL_TRUE).
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);