[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] [gnurl] 198/220: netrc: free 'home' on error
From: |
gnunet |
Subject: |
[GNUnet-SVN] [gnurl] 198/220: netrc: free 'home' on error |
Date: |
Thu, 12 Sep 2019 17:29:18 +0200 |
This is an automated email from the git hooks/post-receive script.
ng0 pushed a commit to branch master
in repository gnurl.
commit 158dcb9f86986bebdb39ecd44237f112c72d761c
Author: Daniel Stenberg <address@hidden>
AuthorDate: Tue Sep 3 13:46:36 2019 +0200
netrc: free 'home' on error
Follow-up to f9c7ba9096ec2
Coverity CID 1453474
Closes #4291
---
lib/netrc.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/lib/netrc.c b/lib/netrc.c
index bceca53f2..c74065e81 100644
--- a/lib/netrc.c
+++ b/lib/netrc.c
@@ -218,8 +218,10 @@ int Curl_parsenetrc(const char *host,
char *filealloc = NULL;
if(!netrcfile) {
- char *home = curl_getenv("HOME"); /* portable environment reader */
- if(home) {
+ char *home = NULL;
+ char *homea = curl_getenv("HOME"); /* portable environment reader */
+ if(homea) {
+ home = homea;
#if defined(HAVE_GETPWUID_R) && defined(HAVE_GETEUID)
}
else {
@@ -227,9 +229,7 @@ int Curl_parsenetrc(const char *host,
char pwbuf[1024];
if(!getpwuid_r(geteuid(), &pw, pwbuf, sizeof(pwbuf), &pw_res)
&& pw_res) {
- home = strdup(pw.pw_dir);
- if(!home)
- return -1;
+ home = pw.pw_dir;
}
#elif defined(HAVE_GETPWUID) && defined(HAVE_GETEUID)
}
@@ -247,8 +247,10 @@ int Curl_parsenetrc(const char *host,
memory) */
filealloc = curl_maprintf("%s%s.netrc", home, DIR_CHAR);
- if(!filealloc)
+ if(!filealloc) {
+ free(homea);
return -1;
+ }
retcode = parsenetrc(host, loginp, passwordp, login_changed,
password_changed, filealloc);
free(filealloc);
@@ -256,13 +258,16 @@ int Curl_parsenetrc(const char *host,
if(retcode == NETRC_FILE_MISSING) {
/* fallback to the old-style "_netrc" file */
filealloc = curl_maprintf("%s%s_netrc", home, DIR_CHAR);
- if(!filealloc)
+ if(!filealloc) {
+ free(homea);
return -1;
+ }
retcode = parsenetrc(host, loginp, passwordp, login_changed,
password_changed, filealloc);
free(filealloc);
}
#endif
+ free(homea);
}
else
retcode = parsenetrc(host, loginp, passwordp, login_changed,
--
To stop receiving notification emails like this one, please contact
address@hidden.
- [GNUnet-SVN] [gnurl] 157/220: docs/examples/curlx: fix errors, (continued)
- [GNUnet-SVN] [gnurl] 157/220: docs/examples/curlx: fix errors, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 161/220: ngtcp2: accept upload via callback, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 169/220: quiche: send the HTTP body correctly on callback uploads, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 186/220: quiche: decrease available buffer size, don't assign it!, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 180/220: ngtcp2: set flow control window to stream buffer size, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 183/220: plan9: fix installation instructions, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 184/220: curl: fix include conditions, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 211/220: urlapi: one colon is enough for the strspn() input (typo), gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 197/220: urldata: avoid 'generic', use dedicated pointers, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 215/220: gitignore: add sig files., gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 198/220: netrc: free 'home' on error,
gnunet <=
- [GNUnet-SVN] [gnurl] 213/220: THANKS: from the 7.66.0 release, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 200/220: KNOWN_BUGS/TODO: cleanup and remove outdated issues, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 206/220: travis: disable ngtcp2 builds (again), gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 193/220: ROADMAP: updated after recent user poll, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 212/220: curl: make sure the parallel transfers do them all, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 199/220: RELEASE-NOTES: synced, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 217/220: update sed script, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 151/220: http: remove chunked-encoding and expect header use for HTTP/3, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 189/220: CI: remove duplicate configure flag for LGTM.com, gnunet, 2019/09/12
- [GNUnet-SVN] [gnurl] 195/220: smtp: check for and bail out on too short EHLO response, gnunet, 2019/09/12