[vlc-commits] video_output: fix leak of config_chain_t

Alexandre Janniaux git at videolan.org
Mon Mar 1 17:23:00 UTC 2021


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Mon Feb 22 18:00:09 2021 +0100| [009dcf422daa8334597b153a653395565fa5564a] | committer: Alexandre Janniaux

video_output: fix leak of config_chain_t

If a video filter has parameters, then a config_chain_t was leaked:

    ./vlc --video-filter='sharpen{sigma=0.05}' video.mkv

    Direct leak of 24 byte(s) in 1 object(s) allocated from:
        #0 0x7f37f3e8ee8f in __interceptor_malloc ../../../../src/libsanitizer/asan/asan_malloc_linux.cpp:145
        #1 0x7f37f370b196 in config_ChainParseOptions ../../src/config/chain.c:198
        #2 0x7f37f370b5c6 in config_ChainCreate ../../src/config/chain.c:245
        #3 0x7f37f3839bb1 in ThreadChangeFilters ../../src/video_output/video_output.c:867
        #4 0x7f37f383db35 in ThreadDisplayPicture ../../src/video_output/video_output.c:1362
        #5 0x7f37f3840bfe in Thread ../../src/video_output/video_output.c:1785
        #6 0x7f37f3d69ea6 in start_thread nptl/pthread_create.c:477

Co-authored-by: Romain Vimont <rom1v at videolabs.io>
Signed-off-by: Alexandre Janniaux <ajanni at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=009dcf422daa8334597b153a653395565fa5564a
---

 src/video_output/video_output.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c
index d04d3f4d11..be501eaea8 100644
--- a/src/video_output/video_output.c
+++ b/src/video_output/video_output.c
@@ -911,13 +911,11 @@ static void ThreadChangeFilters(vout_thread_sys_t *vout)
             filter_t *filter = filter_chain_AppendFilter(chain, e->name, e->cfg,
                                NULL);
             if (!filter)
-            {
                 msg_Err(&vout->obj, "Failed to add filter '%s'", e->name);
-                config_ChainDestroy(e->cfg);
-            }
             else if (a == 1) /* Add callbacks for interactive filters */
                 filter_AddProxyCallbacks(&vout->obj, filter, FilterRestartCallback);
 
+            config_ChainDestroy(e->cfg);
             free(e->name);
             free(e);
         }



More information about the vlc-commits mailing list