Skip to content

Commit 49f0c74

Browse files
committed
free env_var
Signed-off-by: Mateusz Front <[email protected]>
1 parent 9a3510c commit 49f0c74

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/libAtomVM/nifs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1816,7 +1816,7 @@ static term nif_os_getenv_1(Context *ctx, int argc, term argv[])
18161816
VALIDATE_VALUE(env_var_list, term_is_list);
18171817

18181818
int ok;
1819-
const char *env_var = interop_list_to_utf8_string(env_var_list, &ok);
1819+
char *env_var = interop_list_to_utf8_string(env_var_list, &ok);
18201820
if (UNLIKELY(!ok)) {
18211821
RAISE_ERROR(BADARG_ATOM);
18221822
}
@@ -1826,6 +1826,7 @@ static term nif_os_getenv_1(Context *ctx, int argc, term argv[])
18261826
#endif
18271827

18281828
char *env_var_value = getenv(env_var);
1829+
free(env_var);
18291830

18301831
if (IS_NULL_PTR(env_var_value)) {
18311832
#ifndef AVM_NO_SMP

0 commit comments

Comments
 (0)