[vlc-devel] [PATCH 3/3] video_filter: opengl: fix error handling

Romain Vimont rom1v at videolabs.io
Mon Apr 12 15:58:57 UTC 2021


There were 2 problems:
 - if sys->filters could not be created, then vlc_gl_filters_Delete()
   was called, causing a segfault;
 - if the requested filters could not be loaded, then
   vlc_gl_filters_Delete() was not called, leaking sys->filters.
---
 modules/video_filter/opengl.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/video_filter/opengl.c b/modules/video_filter/opengl.c
index 94dcc9b535..529ebf9a6e 100644
--- a/modules/video_filter/opengl.c
+++ b/modules/video_filter/opengl.c
@@ -232,6 +232,7 @@ static int Open( vlc_object_t *obj )
     if (!sys->filters)
     {
         msg_Err(obj, "Could not create filters");
+        free(glfilters_config);
         goto filters_new_failure;
     }
 
@@ -242,7 +243,7 @@ static int Open( vlc_object_t *obj )
     {
         msg_Err(obj, "Could not load filters: %s", glfilters_config);
         free(glfilters_config);
-        goto filter_config_failure;
+        goto filters_load_failure;
     }
     free(glfilters_config);
 
@@ -290,9 +291,10 @@ static int Open( vlc_object_t *obj )
     return VLC_SUCCESS;
 
 init_framebuffer_failure:
-filters_new_failure:
+filters_load_failure:
     vlc_gl_filters_Delete(sys->filters);
 
+filters_new_failure:
 filter_config_failure:
     vlc_gl_interop_Delete(sys->interop);
 
-- 
2.31.0



More information about the vlc-devel mailing list