avfilter/af_ladspa: check return value of getenv()

This commit is contained in:
Paul B Mahol 2020-06-21 21:34:18 +02:00
parent 683a1599d4
commit fdac3c80ac

View File

@ -469,6 +469,7 @@ static av_cold int init(AVFilterContext *ctx)
} else {
// argument is a shared object name
char *paths = av_strdup(getenv("LADSPA_PATH"));
const char *home_path = getenv("HOME");
const char *separator = ":";
if (paths) {
@ -480,12 +481,12 @@ static av_cold int init(AVFilterContext *ctx)
}
av_free(paths);
if (!s->dl_handle && (paths = av_asprintf("%s/.ladspa", getenv("HOME")))) {
if (!s->dl_handle && home_path && (paths = av_asprintf("%s/.ladspa", home_path))) {
s->dl_handle = try_load(paths, s->dl_name);
av_free(paths);
}
if (!s->dl_handle && (paths = av_asprintf("%s/.ladspa/lib", getenv("HOME")))) {
if (!s->dl_handle && home_path && (paths = av_asprintf("%s/.ladspa/lib", home_path))) {
s->dl_handle = try_load(paths, s->dl_name);
av_free(paths);
}