functional: add mntent test
[libc-test.git] / src / regression / putenv-doublefree.c
blobd57bba1e787a1ebb1705022fbad60a2b770e1eb5
1 // commit 9543656cc32fda48fc463f332ee20e91eed2b768 2016-03-06
2 // __putenv could be confused into freeing storage that does not belong to the implementation
3 #define _XOPEN_SOURCE 700
4 #include <stdlib.h>
5 #include <string.h>
7 int main(void)
9 setenv("A", "1", 1);
10 setenv("A", "2", 1);
11 char *c = strdup("A=3");
12 putenv(c);
13 setenv("A", "4", 1);
14 free(c);
15 return 0;