mirror of
https://github.com/moparisthebest/curl
synced 2024-11-12 04:25:08 -05:00
curl/parseconfig: fix mem-leak
When looping, first trying '.curlrc' and then '_curlrc', the function would not free the first string. Closes #4731
This commit is contained in:
parent
14f8b6e69e
commit
f098c9e6f6
@ -97,6 +97,8 @@ int parseconfig(const char *filename, struct GlobalConfig *global)
|
|||||||
int i = 0;
|
int i = 0;
|
||||||
char prefix = '.';
|
char prefix = '.';
|
||||||
do {
|
do {
|
||||||
|
/* if it was allocated in a previous attempt */
|
||||||
|
free(pathalloc);
|
||||||
/* check for .curlrc then _curlrc in the home dir */
|
/* check for .curlrc then _curlrc in the home dir */
|
||||||
pathalloc = curl_maprintf("%s%s%ccurlrc", home, DIR_CHAR, prefix);
|
pathalloc = curl_maprintf("%s%s%ccurlrc", home, DIR_CHAR, prefix);
|
||||||
if(!pathalloc) {
|
if(!pathalloc) {
|
||||||
|
Loading…
Reference in New Issue
Block a user