[vlc-devel] [PATCH] directx: fix presumed memory leak

Lyndon Brown jnqnfe at gmail.com
Wed Sep 30 20:58:24 CEST 2020


preview:

From: Lyndon Brown <jnqnfe at gmail.com>
Date: Tue, 1 Sep 2020 18:50:18 +0100
Subject: d3d9/dxva2: fix presumed memoryleak

the memory allocations were released in the error path but not the
success path.

diff --git a/modules/video_output/opengl/interop_dxva2.c b/modules/video_output/opengl/interop_dxva2.c
index 2b32e93272..134d4b90eb 100644
--- a/modules/video_output/opengl/interop_dxva2.c
+++ b/modules/video_output/opengl/interop_dxva2.c
@@ -380,6 +380,9 @@ static int InitRangeProcessor(struct vlc_gl_interop *interop, IDirect3DDevice9Ex
         msg_Dbg(interop, "Failed to create the processor (error 0x%lX)", hr);
         goto error;
     }
+
+    free(capsList);
+    free(formatsList);
     IDXVAHD_Device_Release( hd_device );
 
     SetupProcessorInput(interop, &interop->fmt_in, src_format);
diff --git a/modules/video_output/win32/direct3d9.c b/modules/video_output/win32/direct3d9.c
index 55235f63d6..c2bc742634 100644
--- a/modules/video_output/win32/direct3d9.c
+++ b/modules/video_output/win32/direct3d9.c
@@ -1588,6 +1588,9 @@ static int InitRangeProcessor(vout_display_t *vd, const d3d9_format_t *d3dfmt,
         msg_Dbg(vd, "Failed to create the processor (error 0x%lX)", hr);
         goto error;
     }
+
+    free(capsList);
+    free(formatsList);
     IDXVAHD_Device_Release( hd_device );
 
     SetupProcessorInput(vd, vd->source, d3dfmt);



More information about the vlc-devel mailing list