aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSteve Holme <steve_holme@hotmail.com>2013-04-20 18:40:13 +0100
committerSteve Holme <steve_holme@hotmail.com>2013-04-20 18:40:13 +0100
commitfe880475ed3c7e51e32e19112252c79e921cc31b (patch)
tree8f182b3888d43ffe86ee2cc5e50418f106e6e7d0 /lib
parent5821d5f11108f3c5268bcdb25b4763ef16e79bbf (diff)
url: Fixed memory leak in setstropt_userpwd()
setstropt_userpwd() was calling setstropt() in commit fddb7b44a79d to set each of the login details which would duplicate the strings and subsequently cause a memory leak.
Diffstat (limited to 'lib')
-rw-r--r--lib/url.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/url.c b/lib/url.c
index d54d49b9e..7b1237289 100644
--- a/lib/url.c
+++ b/lib/url.c
@@ -333,15 +333,18 @@ static CURLcode setstropt_userpwd(char *option, char **user_storage,
if(!result) {
/* store username part of option */
if(user_storage)
- setstropt(user_storage, userp);
+ Curl_safefree(*user_storage);
+ *user_storage = userp;
/* store password part of option */
if(pwd_storage)
- setstropt(pwd_storage, passwdp);
+ Curl_safefree(*pwd_storage);
+ *pwd_storage = passwdp;
/* store options part of option */
if(options_storage)
- setstropt(options_storage, optionsp);
+ Curl_safefree(*options_storage);
+ *options_storage = optionsp;
}
return result;