I think it is the strdup call rather than the null pointer
check that fixes the crash. The string you pass to PR_SetEnv,
which simply passes it to putenv, needs to stay around after
PR_SetEnv returns because the string "shall become part of the
environment": http://www.opengroup.org/onlinepubs/009695399/functions/putenv.html
The putenv man page also says:
A potential error is to call putenv() with an automatic
variable as the argument, then return from the calling
function while string is still part of the environment.
I think it is the strdup call rather than the null pointer www.opengroup. org/onlinepubs/ 009695399/ functions/ putenv. html
check that fixes the crash. The string you pass to PR_SetEnv,
which simply passes it to putenv, needs to stay around after
PR_SetEnv returns because the string "shall become part of the
environment":
http://
The putenv man page also says:
A potential error is to call putenv() with an automatic
variable as the argument, then return from the calling
function while string is still part of the environment.