Blame src/regression/putenv-doublefree.c
|
Alexander Monakov |
ccec43 |
// commit 9543656cc32fda48fc463f332ee20e91eed2b768 2016-03-06
|
|
Alexander Monakov |
ccec43 |
// __putenv could be confused into freeing storage that does not belong to the implementation
|
|
Szabolcs Nagy |
87d327 |
#define _XOPEN_SOURCE 700
|
|
Alexander Monakov |
ccec43 |
#include <stdlib.h>
|
|
Alexander Monakov |
ccec43 |
#include <string.h>
|
|
Alexander Monakov |
ccec43 |
|
|
Alexander Monakov |
ccec43 |
int main(void)
|
|
Alexander Monakov |
ccec43 |
{
|
|
Alexander Monakov |
ccec43 |
setenv("A", "1", 1);
|
|
Alexander Monakov |
ccec43 |
setenv("A", "2", 1);
|
|
Alexander Monakov |
ccec43 |
char *c = strdup("A=3");
|
|
Alexander Monakov |
ccec43 |
putenv(c);
|
|
Alexander Monakov |
ccec43 |
setenv("A", "4", 1);
|
|
Alexander Monakov |
ccec43 |
free(c);
|
|
Alexander Monakov |
ccec43 |
return 0;
|
|
Alexander Monakov |
ccec43 |
}
|