[vlc-devel] [PATCH 1/4] libvlc: the string returned by libvlc_media_get_mrl() must use libvlc_free()

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


---
 include/vlc/libvlc_media.h     | 3 ++-
 test/libvlc/media.c            | 2 +-
 test/libvlc/media_discoverer.c | 2 +-
 test/libvlc/slaves.c           | 6 +++---
 4 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/include/vlc/libvlc_media.h b/include/vlc/libvlc_media.h
index c705125233..f4db0e8c14 100644
--- a/include/vlc/libvlc_media.h
+++ b/include/vlc/libvlc_media.h
@@ -547,7 +547,8 @@ LIBVLC_API void libvlc_media_release( libvlc_media_t *p_md );
  * Get the media resource locator (mrl) from a media descriptor object
  *
  * \param p_md a media descriptor object
- * \return string with mrl of media descriptor object
+ * \return string with mrl of media descriptor object.
+ *         (it must be released with libvlc_free())
  */
 LIBVLC_API char *libvlc_media_get_mrl( libvlc_media_t *p_md );
 
diff --git a/test/libvlc/media.c b/test/libvlc/media.c
index d6e2484357..4b789c1955 100644
--- a/test/libvlc/media.c
+++ b/test/libvlc/media.c
@@ -227,7 +227,7 @@ static void subitem_added(const libvlc_event_t *event, void *user_data)
             subitems_found[i] = true;
         }
     }
-    free (mrl);
+    libvlc_free (mrl);
 #undef FILE_SEPARATOR
 }
 
diff --git a/test/libvlc/media_discoverer.c b/test/libvlc/media_discoverer.c
index dde3b94a16..41551a8d59 100644
--- a/test/libvlc/media_discoverer.c
+++ b/test/libvlc/media_discoverer.c
@@ -30,7 +30,7 @@ ml_item_event(const struct libvlc_event_t *p_ev, const char *psz_event)
 
     test_log("item %s(%d): '%s'\n", psz_event,
              p_ev->u.media_list_item_added.index, psz_mrl);
-    free(psz_mrl);
+    libvlc_free(psz_mrl);
 }
 
 static void
diff --git a/test/libvlc/slaves.c b/test/libvlc/slaves.c
index 7b2c24fa43..ace6d6d6a0 100644
--- a/test/libvlc/slaves.c
+++ b/test/libvlc/slaves.c
@@ -138,11 +138,11 @@ test_media_has_slaves_from_parent(libvlc_instance_t *p_vlc,
             free(psz_mrl);
             break;
         }
-        free(psz_mrl);
+        libvlc_free(psz_mrl);
         libvlc_media_release(p_subm);
         p_subm = NULL;
     }
-    free(psz_main_media_mrl);
+    libvlc_free(psz_main_media_mrl);
     libvlc_media_list_unlock(p_ml);
     libvlc_media_list_release(p_ml);
 
@@ -236,7 +236,7 @@ main (void)
     libvlc_release(p_vlc);
 
     for (unsigned int i = 0; i < EXPECTED_SLAVES_COUNT; ++i)
-        free(p_expected_slaves[i].psz_uri);
+        libvlc_free(p_expected_slaves[i].psz_uri);
 
     return 0;
 }
-- 
2.17.1



More information about the vlc-devel mailing list