summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
Diffstat (limited to 'video')
-rw-r--r--video/out/gpu/lcms.c13
-rw-r--r--video/out/vo_gpu_next.c15
2 files changed, 18 insertions, 10 deletions
diff --git a/video/out/gpu/lcms.c b/video/out/gpu/lcms.c
index 7880f279e6..47ea160d8c 100644
--- a/video/out/gpu/lcms.c
+++ b/video/out/gpu/lcms.c
@@ -359,12 +359,13 @@ bool gl_lcms_get_lut3d(struct gl_lcms *p, struct lut3d **result_lut3d,
cache_dir = mp_find_user_file(tmp, p->global, "cache", "");
}
- cache_file = talloc_strdup(tmp, "");
- for (int i = 0; i < sizeof(hash); i++)
- cache_file = talloc_asprintf_append(cache_file, "%02X", hash[i]);
- cache_file = mp_path_join(tmp, cache_dir, cache_file);
-
- mp_mkdirp(cache_dir);
+ if (cache_dir && cache_dir[0]) {
+ cache_file = talloc_strdup(tmp, "");
+ for (int i = 0; i < sizeof(hash); i++)
+ cache_file = talloc_asprintf_append(cache_file, "%02X", hash[i]);
+ cache_file = mp_path_join(tmp, cache_dir, cache_file);
+ mp_mkdirp(cache_dir);
+ }
}
// check cache
diff --git a/video/out/vo_gpu_next.c b/video/out/vo_gpu_next.c
index a8e8e1fae5..93cf4f54d6 100644
--- a/video/out/vo_gpu_next.c
+++ b/video/out/vo_gpu_next.c
@@ -1381,9 +1381,10 @@ static void wait_events(struct vo *vo, int64_t until_time_us)
static char *get_cache_file(struct priv *p)
{
+ char *file = NULL;
struct gl_video_opts *opts = p->opts_cache->opts;
if (!opts->shader_cache)
- return NULL;
+ goto done;
char *dir = opts->shader_cache_dir;
if (dir && dir[0]) {
@@ -1391,9 +1392,12 @@ static char *get_cache_file(struct priv *p)
} else {
dir = mp_find_user_file(NULL, p->global, "cache", "");
}
- char *file = mp_path_join(NULL, dir, "libplacebo.cache");
- mp_mkdirp(dir);
+ if (dir && dir[0]) {
+ file = mp_path_join(NULL, dir, "libplacebo.cache");
+ mp_mkdirp(dir);
+ }
talloc_free(dir);
+done:
return file;
}
@@ -1635,8 +1639,11 @@ static stream_t *icc_open_cache(struct priv *p, uint64_t sig, int flags)
} else {
cache_dir = mp_find_user_file(NULL, p->global, "cache", "");
}
- char *path = mp_path_join(NULL, cache_dir, cache_name);
+ if (!cache_dir || !cache_dir[0])
+ return NULL;
+
+ char *path = mp_path_join(NULL, cache_dir, cache_name);
stream_t *stream = NULL;
if (flags & STREAM_WRITE) {
mp_mkdirp(cache_dir);