mirror of
https://github.com/mpv-player/mpv.git
synced 2024-09-20 12:02:23 +02:00
Config path functions can return NULL
It's quite unlikely, but functions like mp_find_user_config_file() can return NULL, e.g. if $HOME is unset. Fix all the code that didn't check for this correctly yet.
This commit is contained in:
parent
1298dbdf01
commit
5249cccfcf
@ -99,6 +99,12 @@ static int control(struct af_instance* af, int cmd, void* arg)
|
|||||||
for(i = 1; i < af->data->nch; i++)
|
for(i = 1; i < af->data->nch; i++)
|
||||||
s->buf[i] = (uint8_t *)s->buf[0] + i*s->sz*af->data->bps;
|
s->buf[i] = (uint8_t *)s->buf[0] + i*s->sz*af->data->bps;
|
||||||
|
|
||||||
|
if (!s->filename) {
|
||||||
|
mp_msg(MSGT_AFILTER, MSGL_FATAL, "[export] No filename set.\n",
|
||||||
|
s->filename);
|
||||||
|
return AF_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
// Init memory mapping
|
// Init memory mapping
|
||||||
s->fd = open(s->filename, O_RDWR | O_CREAT | O_TRUNC, 0640);
|
s->fd = open(s->filename, O_RDWR | O_CREAT | O_TRUNC, 0640);
|
||||||
mp_msg(MSGT_AFILTER, MSGL_INFO, "[export] Exporting to file: %s\n", s->filename);
|
mp_msg(MSGT_AFILTER, MSGL_INFO, "[export] Exporting to file: %s\n", s->filename);
|
||||||
|
@ -637,9 +637,11 @@ static void mk_config_dir(char *subdir)
|
|||||||
{
|
{
|
||||||
void *tmp = talloc_new(NULL);
|
void *tmp = talloc_new(NULL);
|
||||||
char *confdir = talloc_steal(tmp, mp_find_user_config_file(""));
|
char *confdir = talloc_steal(tmp, mp_find_user_config_file(""));
|
||||||
if (subdir)
|
if (confdir) {
|
||||||
confdir = mp_path_join(tmp, bstr0(confdir), bstr0(subdir));
|
if (subdir)
|
||||||
mkdir(confdir, 0777);
|
confdir = mp_path_join(tmp, bstr0(confdir), bstr0(subdir));
|
||||||
|
mkdir(confdir, 0777);
|
||||||
|
}
|
||||||
talloc_free(tmp);
|
talloc_free(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user