[vlc-devel] [PATCH] modules/bank: refactor strdup error

Alexandre Janniaux ajanni at videolabs.io
Tue Nov 26 15:17:19 CET 2019


---
 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)
-- 
2.24.0



More information about the vlc-devel mailing list