[vlc-commits] misc/renderer_discovery: vlc_rd_new: fix leak on error

Filip Roséen git at videolan.org
Thu May 18 16:29:11 CEST 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Thu May 18 13:26:57 2017 +0200| [00764b2bced8512b18303197ec030be6d3d55d29] | committer: Hugo Beauzée-Luyssen

misc/renderer_discovery: vlc_rd_new: fix leak on error

If no module can be found, the previous implementation would leak the
resources potentially allocated through config_ChainCreate.

Signed-off-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>

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

 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;
     }



More information about the vlc-commits mailing list