From 613e5cbb5e0a7626377876e9a441c614afe1e25e Mon Sep 17 00:00:00 2001
From: John Cox <jc@kynesim.co.uk>
Date: Tue, 30 Jan 2024 14:24:59 +0000
Subject: [PATCH 05/14] drm_vout: Fix connector etc. desc memory leak

---
 libavdevice/drm_vout.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/libavdevice/drm_vout.c b/libavdevice/drm_vout.c
index 491e1dc608..275748abdc 100644
--- a/libavdevice/drm_vout.c
+++ b/libavdevice/drm_vout.c
@@ -501,6 +501,13 @@ static int find_crtc(struct AVFormatContext * const avctx, int drmfd, struct drm
                 crtc ? crtc->height : 0,
                 (s->conId == (int)con->connector_id ?
             " (chosen)" : ""));
+
+          if (crtc)
+              drmModeFreeCrtc(crtc);
+          if (enc)
+              drmModeFreeEncoder(enc);
+          if (con)
+              drmModeFreeConnector(con);
       }
 
       if (!s->conId) {
-- 
2.34.1

