diff options
Diffstat (limited to 'lib/getenv.c')
-rw-r--r-- | lib/getenv.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/getenv.c b/lib/getenv.c index 54b0118b6..ff6f541b6 100644 --- a/lib/getenv.c +++ b/lib/getenv.c @@ -39,6 +39,7 @@ #include <stdio.h> #include <stdlib.h> +#include <string.h> #ifdef WIN32 #include <windows.h> @@ -48,7 +49,7 @@ char *GetEnv(char *variable) { #ifdef WIN32 /* This shit requires windows.h (HUGE) to be included */ - static char env[MAX_PATH]; /* MAX_PATH is from windef.h */ + char env[MAX_PATH]; /* MAX_PATH is from windef.h */ char *temp = getenv(variable); env[0] = '\0'; ExpandEnvironmentStrings(temp, env, sizeof(env)); @@ -56,7 +57,7 @@ char *GetEnv(char *variable) /* no length control */ char *env = getenv(variable); #endif - return env; + return env?strdup(env):NULL; } char *curl_GetEnv(char *v) |