[vlc-commits] access: bluray: fix psz_lang leak

Francois Cartegnie git at videolan.org
Wed Dec 4 18:51:53 CET 2019


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Wed Dec  4 17:37:38 2019 +0100| [9a8e19e3c9d12b77ef5b534b46772f6dbb1a0bf6] | committer: Francois Cartegnie

access: bluray: fix psz_lang leak

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

 modules/access/bluray.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/modules/access/bluray.c b/modules/access/bluray.c
index 534ddd8a89..9e9368094c 100644
--- a/modules/access/bluray.c
+++ b/modules/access/bluray.c
@@ -400,13 +400,18 @@ static bool es_pair_Add(vlc_array_t *p_array, const es_format_t *p_fmt,
     return p_pair != NULL;
 }
 
-static void es_pair_Remove(vlc_array_t *p_array, es_pair_t *p_pair)
+static void es_pair_Delete(es_pair_t *p_pair)
 {
-    vlc_array_remove(p_array, vlc_array_index_of_item(p_array, p_pair));
     es_format_Clean(&p_pair->fmt);
     free(p_pair);
 }
 
+static void es_pair_Remove(vlc_array_t *p_array, es_pair_t *p_pair)
+{
+    vlc_array_remove(p_array, vlc_array_index_of_item(p_array, p_pair));
+    es_pair_Delete(p_pair);
+}
+
 static es_pair_t *getEsPair(vlc_array_t *p_array,
                             bool (*match)(const es_pair_t *, const void *),
                             const void *param)
@@ -1571,7 +1576,7 @@ static void bluray_esOutDestroy(es_out_t *p_out)
     bluray_esout_priv_t *esout_priv = container_of(p_out, bluray_esout_priv_t, es_out);
 
     for (size_t i = 0; i < vlc_array_count(&esout_priv->es); ++i)
-        free(vlc_array_item_at_index(&esout_priv->es, i));
+        es_pair_Delete(vlc_array_item_at_index(&esout_priv->es, i));
     vlc_array_clear(&esout_priv->es);
     vlc_mutex_destroy(&esout_priv->lock);
     free(esout_priv);



More information about the vlc-commits mailing list