summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2000-05-29 23:09:31 +0000
committerDaniel Stenberg <daniel@haxx.se>2000-05-29 23:09:31 +0000
commit15c143bba91bec19bac431db32bc2d65a75e3ece (patch)
tree44ee054b8655497503102a24fbc307724ed71ac5 /src
parent6d522c9c1dae070f73aae1022b09b68f9153959e (diff)
downloadcurl-15c143bba91bec19bac431db32bc2d65a75e3ece.tar.gz
modified to the new curl_getenv() style
Diffstat (limited to 'src')
-rw-r--r--src/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index dda97447d..24df3062a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -832,16 +832,21 @@ static int parseconfig(char *filename,
char configbuffer[4096];
char filebuffer[256];
bool usedarg;
+ char *home=NULL;
if(!filename || !*filename) {
/* NULL or no file name attempts to load .curlrc from the homedir! */
#define CURLRC DOT_CHAR "curlrc"
- char *home = curl_GetEnv("HOME"); /* portable environment reader */
+ home = curl_GetEnv("HOME"); /* portable environment reader */
- if(!home || (strlen(home)>(sizeof(filebuffer)-strlen(CURLRC))))
+ if(!home)
return CURLE_OK;
+ if(strlen(home)>(sizeof(filebuffer)-strlen(CURLRC))) {
+ free(home);
+ return CURLE_OK;
+ }
sprintf(filebuffer, "%s%s%s", home, DIR_CHAR, CURLRC);
@@ -909,6 +914,8 @@ static int parseconfig(char *filename,
if(file != stdin)
fclose(file);
}
+ if(home)
+ free(home);
return CURLE_OK;
}