[vlc-devel] [PATCH] kms: fix use-after-free on device string
Alexandre Janniaux
ajanni at videolabs.io
Fri Apr 16 18:26:40 UTC 2021
---
modules/video_output/kms.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/modules/video_output/kms.c b/modules/video_output/kms.c
index 9965f3a8ef..d1b6dbc7d6 100644
--- a/modules/video_output/kms.c
+++ b/modules/video_output/kms.c
@@ -525,12 +525,14 @@ static int OpenDisplay(vout_display_t *vd)
free(psz_device);
return VLC_EGENERIC;
}
- free(psz_device);
drmSetClientCap(sys->drm_fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
if (!ChromaNegotiation(vd))
+ {
+ free(psz_device);
goto err_out;
+ }
msg_Dbg(vd, "Using VLC chroma '%.4s', DRM chroma '%.4s'",
(char*)&sys->vlc_fourcc, (char*)&sys->drm_fourcc);
@@ -538,8 +540,10 @@ static int OpenDisplay(vout_display_t *vd)
ret = drmGetCap(sys->drm_fd, DRM_CAP_DUMB_BUFFER, &dumbRet);
if (ret < 0 || !dumbRet) {
msg_Err(vd, "Device '%s' does not support dumb buffers", psz_device);
+ free(psz_device);
goto err_out;
}
+ free(psz_device);
modeRes = drmModeGetResources(sys->drm_fd);
if (modeRes == NULL) {
--
2.31.1
More information about the vlc-devel
mailing list