[libbdplus-devel] Merge changes from other libs

anonymous git at videolan.org
Fri Mar 3 14:33:01 CET 2017


libbdplus | branch: master | anonymous <anonymous at anonymous.org> | Fri Mar  3 15:05:11 2017 +0200| [e89c271fe1b353b93ae09b8fb5646c24f6b57215] | committer: anonymous

Merge changes from other libs

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

 src/file/configfile.c  |  5 +++++
 src/file/dirs_darwin.c | 17 ++---------------
 2 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/src/file/configfile.c b/src/file/configfile.c
index bb641ac..6462aeb 100644
--- a/src/file/configfile.c
+++ b/src/file/configfile.c
@@ -171,6 +171,11 @@ static char *_load_fp(FILE *fp, uint32_t *p_size)
     }
 
     data      = malloc(file_size + 1);
+    if (!data) {
+        BD_DEBUG(DBG_FILE, "Out of memory\n");
+        return NULL;
+    }
+
     read_size = fread(data, 1, file_size, fp);
 
     if (read_size != file_size) {
diff --git a/src/file/dirs_darwin.c b/src/file/dirs_darwin.c
index 8ff32e4..09b3c78 100644
--- a/src/file/dirs_darwin.c
+++ b/src/file/dirs_darwin.c
@@ -73,23 +73,10 @@ char *file_get_cache_home(void)
 
 const char *file_get_config_system(const char *dir)
 {
-    static char *dirs = NULL; // "dir1\0dir2\0...\0dirN\0\0"
-
-    if (!dirs) {
-        dirs = str_printf("%s%c%c", SYSTEM_CFG_DIR, 0, 0);
-    }
-
     if (!dir) {
         // first call
-        dir = dirs;
-    } else {
-        // next call
-        dir += strlen(dir) + 1;
-        if (!*dir) {
-            // end of list
-            dir = NULL;
-        }
+        return SYSTEM_CFG_DIR;
     }
 
-    return dir;
+    return NULL;
 }



More information about the libbdplus-devel mailing list