summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-12-18 13:30:39 +0100
committerDaniel Stenberg <daniel@haxx.se>2019-12-18 14:48:32 +0100
commitf098c9e6f6dab9a2b08e91d2b5180e65166676b6 (patch)
treeb6ae38721b237425d986f5160fa5891e17a49b0c /src
parent14f8b6e69e97e60f43c3188d2e22c10f05554a10 (diff)
downloadcurl-f098c9e6f6dab9a2b08e91d2b5180e65166676b6.tar.gz
curl/parseconfig: fix mem-leak
When looping, first trying '.curlrc' and then '_curlrc', the function would not free the first string. Closes #4731
Diffstat (limited to 'src')
-rw-r--r--src/tool_parsecfg.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c
index 9b32e54a0..208897f48 100644
--- a/src/tool_parsecfg.c
+++ b/src/tool_parsecfg.c
@@ -97,6 +97,8 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
int i = 0;
char prefix = '.';
do {
+ /* if it was allocated in a previous attempt */
+ free(pathalloc);
/* check for .curlrc then _curlrc in the home dir */
pathalloc = curl_maprintf("%s%s%ccurlrc", home, DIR_CHAR, prefix);
if(!pathalloc) {