vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Thu Oct 27 21:30:44 2016 +0300| [e817199bdd19e4dd24121b062b5244bd9d453a2d] | committer: Rémi Denis-Courmont
modules: allocate absolute path during cache loading > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e817199bdd19e4dd24121b062b5244bd9d453a2d --- src/modules/bank.c | 12 +----------- src/modules/cache.c | 8 ++++++++ 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/modules/bank.c b/src/modules/bank.c index 52b71a6..1065c1e 100644 --- a/src/modules/bank.c +++ b/src/modules/bank.c @@ -172,17 +172,7 @@ static int AllocatePluginFile (module_bank_t *bank, const char *abspath, /* Check our plugins cache first then load plugin if needed */ if (bank->mode == CACHE_USE) - { - vlc_plugin_t *cache = vlc_cache_lookup(&bank->cache, relpath, st); - if (cache != NULL) - { - cache->abspath = strdup(abspath); - if (likely(cache->abspath != NULL)) - plugin = cache; - else - vlc_plugin_destroy(cache); - } - } + plugin = vlc_cache_lookup(&bank->cache, relpath, st); if (plugin == NULL) { plugin = module_InitDynamic(bank->obj, abspath, true); diff --git a/src/modules/cache.c b/src/modules/cache.c index e727fa2..088a3b5 100644 --- a/src/modules/cache.c +++ b/src/modules/cache.c @@ -457,6 +457,14 @@ vlc_plugin_t *vlc_cache_load(vlc_object_t *p_this, const char *dir, if (plugin == NULL) goto error; + if (unlikely(asprintf(&plugin->abspath, "%s" DIR_SEP "%s", dir, + plugin->path) == -1)) + { + plugin->abspath = NULL; + vlc_plugin_destroy(plugin); + goto error; + } + plugin->next = cache; cache = plugin; } _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
