[vlc-devel] [PATCH 3/4] libvlc: the result from libvlc_media_get_meta() must use libvlc_free()

Steve Lhomme robux4 at ycbcr.xyz
Mon Jun 3 16:02:06 CEST 2019


---
 include/vlc/libvlc_media.h      | 1 +
 test/libvlc/media.c             | 2 +-
 test/libvlc/media_list_player.c | 4 ++--
 test/libvlc/meta.c              | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index f4db0e8c14..768c7c30c4 100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -573,6 +573,7 @@ LIBVLC_API libvlc_media_t *libvlc_media_duplicate( libvlc_media_t *p_md );
  * \param p_md the media descriptor
  * \param e_meta the meta to read
  * \return the media's meta
+ *         (it must be released by libvlc_free())
  */
 LIBVLC_API char *libvlc_media_get_meta( libvlc_media_t *p_md,
                                              libvlc_meta_t e_meta );
diff --git a/test/libvlc/media.c b/test/libvlc/media.c
index 4b789c1955..39a99ee2e7 100644
--- a/test/libvlc/media.c
+++ b/test/libvlc/media.c
@@ -84,7 +84,7 @@ static void print_media(libvlc_media_t *media)
         char *psz_meta = libvlc_media_get_meta(media, i);
         if (psz_meta != NULL)
             test_log("\tmeta(%d): '%s'\n", i, psz_meta);
-        free(psz_meta);
+        libvlc_free(psz_meta);
     }
 }
 
diff --git a/test/libvlc/media_list_player.c b/test/libvlc/media_list_player.c
index 27cf3e1fbc..1660eff003 100644
--- a/test/libvlc/media_list_player.c
+++ b/test/libvlc/media_list_player.c
@@ -91,13 +91,13 @@ static void check_items_order_callback(const libvlc_event_t * p_event, void * us
     {
         char *title = libvlc_media_get_meta(md, libvlc_meta_Title);
         test_log ("Got items %s\n", title);
-        free(title);
+        libvlc_free(title);
     }
     assert(checks->items[checks->index] == md);
 
     char *title = libvlc_media_get_meta(md, libvlc_meta_Title);
     test_log ("Item %d '%s' was correctly queued\n", checks->index, title);
-    free(title);
+    libvlc_free(title);
 
     if (checks->index == (checks->count - 1))
     {
diff --git a/test/libvlc/meta.c b/test/libvlc/meta.c
index 6160fc5a4b..d2a00e8e08 100644
--- a/test/libvlc/meta.c
+++ b/test/libvlc/meta.c
@@ -51,7 +51,7 @@ static void test_meta (const char ** argv, int argc)
     int string_compare = strcmp (artist, expected_artist);
     assert (!string_compare);
 
-    free (artist);
+    libvlc_free (artist);
     libvlc_media_release (media);
     libvlc_release (vlc);
 }
-- 
2.17.1



More information about the vlc-devel mailing list