Skip to content

Commit 69364a0

Browse files
nihil-admirarimstorsjo
authored andcommitted
libavfilter/vf_frei0r.c: Use UTF-8 version of getenv()
Signed-off-by: Martin Storsjö <[email protected]>
1 parent c381f54 commit 69364a0

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

libavfilter/vf_frei0r.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "libavutil/avstring.h"
3232
#include "libavutil/common.h"
3333
#include "libavutil/eval.h"
34+
#include "libavutil/getenv_utf8.h"
3435
#include "libavutil/imgutils.h"
3536
#include "libavutil/internal.h"
3637
#include "libavutil/mathematics.h"
@@ -204,7 +205,7 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
204205
}
205206

206207
/* see: http://frei0r.dyne.org/codedoc/html/group__pluglocations.html */
207-
if ((path = av_strdup(getenv("FREI0R_PATH")))) {
208+
if (path = getenv_dup("FREI0R_PATH")) {
208209
#ifdef _WIN32
209210
const char *separator = ";";
210211
#else
@@ -231,12 +232,17 @@ static av_cold int frei0r_init(AVFilterContext *ctx,
231232
if (ret < 0)
232233
return ret;
233234
}
234-
if (!s->dl_handle && (path = getenv("HOME"))) {
235+
if (!s->dl_handle && (path = getenv_utf8("HOME"))) {
235236
char *prefix = av_asprintf("%s/.frei0r-1/lib/", path);
236-
if (!prefix)
237-
return AVERROR(ENOMEM);
237+
if (!prefix) {
238+
ret = AVERROR(ENOMEM);
239+
goto home_path_end;
240+
}
238241
ret = load_path(ctx, &s->dl_handle, prefix, dl_name);
239242
av_free(prefix);
243+
244+
home_path_end:
245+
freeenv_utf8(path);
240246
if (ret < 0)
241247
return ret;
242248
}

0 commit comments

Comments
 (0)