[vlc-commits] modules/bank: refactor strdup error

Alexandre Janniaux git at videolan.org
Thu Dec 5 17:17:53 CET 2019


vlc | branch: master | Alexandre Janniaux <ajanni at videolabs.io> | Tue Nov 26 15:17:19 2019 +0100| [474a8c907cb826396d011d77a1c0dca53c59fe82] | committer: Thomas Guillem

modules/bank: refactor strdup error

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 src/modules/bank.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/modules/bank.c b/src/modules/bank.c
index 275680456b..36c4b30cdd 100644
--- a/src/modules/bank.c
+++ b/src/modules/bank.c
@@ -321,14 +321,19 @@ static int AllocatePluginFile (module_bank_t *bank, const char *abspath,
 
     if (plugin == NULL)
     {
+        char *path = strdup(relpath);
+        if (path == NULL)
+            return -1;
+
         plugin = module_InitDynamic(bank->obj, abspath, true);
 
         if (plugin != NULL)
         {
-            plugin->path = xstrdup(relpath);
+            plugin->path = path;
             plugin->mtime = st->st_mtime;
             plugin->size = st->st_size;
         }
+        else free(path);
     }
 
     if (plugin == NULL)



More information about the vlc-commits mailing list