From: Daniel Stenberg Date: Wed, 18 Dec 2019 12:30:39 +0000 (+0100) Subject: curl/parseconfig: fix mem-leak X-Git-Tag: curl-7_68_0~41 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f098c9e6f6dab9a2b08e91d2b5180e65166676b6;p=thirdparty%2Fcurl.git curl/parseconfig: fix mem-leak When looping, first trying '.curlrc' and then '_curlrc', the function would not free the first string. Closes #4731 --- diff --git a/src/tool_parsecfg.c b/src/tool_parsecfg.c index 9b32e54a02..208897f48c 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) {