[vlc-commits] test: fix memory leaks (fixes #14730)

Rémi Denis-Courmont git at videolan.org
Sat Jan 2 17:25:58 CET 2016


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sat Jan  2 18:25:07 2016 +0200| [000feece0e85183d4e58ec0c0f64f957a0991c86] | committer: Rémi Denis-Courmont

test: fix memory leaks (fixes #14730)

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

 test/libvlc/media_list.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/test/libvlc/media_list.c b/test/libvlc/media_list.c
index 7eab6b9..743390a 100644
--- a/test/libvlc/media_list.c
+++ b/test/libvlc/media_list.c
@@ -26,7 +26,7 @@
 static void test_media_list (const char ** argv, int argc)
 {
     libvlc_instance_t *vlc;
-    libvlc_media_t *md1, *md2, *md3, *md4;
+    libvlc_media_t *md, *md1, *md2, *md3, *md4;
     libvlc_media_list_t *ml;
     int ret;
 
@@ -77,9 +77,13 @@ static void test_media_list (const char ** argv, int argc)
     assert( libvlc_media_list_index_of_item (ml, md3) == 2 );
 
     /* test right returning descriptor*/
-    assert ( libvlc_media_list_item_at_index (ml, 0) == md2 );
+    md = libvlc_media_list_item_at_index (ml, 0);
+    assert(md == md2);
+    libvlc_media_release(md);
 
-    assert ( libvlc_media_list_item_at_index (ml, 2) == md3 );
+    md = libvlc_media_list_item_at_index (ml, 2);
+    assert(md == md3);
+    libvlc_media_release(md);
 
     /* test if give errors, when it should */
     /* have 4 items, so index 4 should give error */



More information about the vlc-commits mailing list