mirror of
https://github.com/fluencelabs/musl
synced 2025-04-25 07:12:15 +00:00
env: avoid leaving dangling pointers in __env_map
This is the minimal fix for __putenv leaving a pointer to freed heap storage in __env_map array, which could later on lead to errors such as double-free.
This commit is contained in:
parent
589aefa5b0
commit
9543656cc3
1
src/env/putenv.c
vendored
1
src/env/putenv.c
vendored
@ -30,6 +30,7 @@ int __putenv(char *s, int a)
|
||||
}
|
||||
} else {
|
||||
free(__env_map[j]);
|
||||
__env_map[j] = s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user