[FFmpeg-cvslog] avfilter/af_ladspa: check return value of getenv()

Paul B Mahol git at videolan.org
Sun Jun 21 22:37:44 EEST 2020


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Sun Jun 21 21:34:18 2020 +0200| [fdac3c80ac65f6c6fb2fedae7d6236044ba531c5] | committer: Paul B Mahol

avfilter/af_ladspa: check return value of getenv()

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

 libavfilter/af_ladspa.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavfilter/af_ladspa.c b/libavfilter/af_ladspa.c
index 0d7ceb2777..ce695db9ff 100644
--- a/libavfilter/af_ladspa.c
+++ b/libavfilter/af_ladspa.c
@@ -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);
         }



More information about the ffmpeg-cvslog mailing list