[vlc-devel] [PATCH 1/2] misc/renderer_discovery: vlc_rd_new: fix leak on error

Filip Roséen filip at atch.se
Thu May 18 13:26:57 CEST 2017


If no module can be found, the previous implementation would leak the
resources potentially allocated through config_ChainCreate.
---
 src/misc/renderer_discovery.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/misc/renderer_discovery.c b/src/misc/renderer_discovery.c
index b89dca309c..dc4140b922 100644
--- a/src/misc/renderer_discovery.c
+++ b/src/misc/renderer_discovery.c
@@ -257,6 +257,8 @@ vlc_rd_new(vlc_object_t *p_obj, const char *psz_name,
     if (p_rd->p_module == NULL)
     {
         msg_Err(p_rd, "no suitable renderer discovery module");
+        free(p_rd->psz_name);
+        config_ChainDestroy(p_rd->p_cfg);
         vlc_object_release(p_rd);
         p_rd = NULL;
     }
-- 
2.12.2


More information about the vlc-devel mailing list