hm, don't free the home dir and append the .netrc part properly
This commit is contained in:
Родитель
92186dc3d3
Коммит
a564a54e21
20
lib/netrc.c
20
lib/netrc.c
|
@ -83,7 +83,7 @@ int Curl_parsenetrc(char *host,
|
|||
struct passwd *pw;
|
||||
pw= getpwuid(geteuid());
|
||||
if (pw)
|
||||
strncat(netrcbuffer, pw->pw_dir, 255);
|
||||
home = pw->pw_dir;
|
||||
#else
|
||||
void *pw=NULL;
|
||||
#endif
|
||||
|
@ -93,15 +93,16 @@ int Curl_parsenetrc(char *host,
|
|||
if(!home) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if(strlen(home)>(sizeof(netrcbuffer)-strlen(NETRC))) {
|
||||
free(home);
|
||||
return -1;
|
||||
}
|
||||
|
||||
sprintf(netrcbuffer, "%s%s%s", home, DIR_CHAR, NETRC);
|
||||
}
|
||||
|
||||
if(strlen(home)>(sizeof(netrcbuffer)-strlen(NETRC))) {
|
||||
if(NULL==pw)
|
||||
free(home);
|
||||
return -1;
|
||||
}
|
||||
|
||||
sprintf(netrcbuffer, "%s%s%s", home, DIR_CHAR, NETRC);
|
||||
|
||||
file = fopen(netrcbuffer, "r");
|
||||
if(file) {
|
||||
char *tok;
|
||||
|
@ -164,7 +165,8 @@ int Curl_parsenetrc(char *host,
|
|||
fclose(file);
|
||||
}
|
||||
|
||||
free(home);
|
||||
if(NULL==pw)
|
||||
free(home);
|
||||
|
||||
return retcode;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче