[vlc-commits] media source: add missing refcount increment

Romain Vimont git at videolan.org
Mon Jan 28 11:50:47 CET 2019


vlc | branch: master | Romain Vimont <rom1v at videolabs.io> | Sun Jan 27 11:02:25 2019 +0100| [ca07827cbf4065d8f34b86f4a9f82e4b4cdc48f6] | committer: Thomas Guillem

media source: add missing refcount increment

If a media source was already created in _GetMediaSource(), its refcount
was not incremented.

Reported-by: Hugo Beauzée-Luyssen <hugo at beauzee.fr>
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 src/media_source/media_source.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/media_source/media_source.c b/src/media_source/media_source.c
index 1bf7c4db83..973570b4ae 100644
--- a/src/media_source/media_source.c
+++ b/src/media_source/media_source.c
@@ -267,7 +267,9 @@ vlc_media_source_provider_GetMediaSource(vlc_media_source_provider_t *provider,
 {
     vlc_mutex_lock(&provider->lock);
     vlc_media_source_t *ms = vlc_media_source_provider_Find(provider, name);
-    if (!ms)
+    if (ms)
+        vlc_media_source_Hold(ms);
+    else
         ms = vlc_media_source_provider_Add(provider, name);
     vlc_mutex_unlock(&provider->lock);
 



More information about the vlc-commits mailing list