summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2019-10-01 23:45:04 +0200
committerDaniel Stenberg <daniel@haxx.se>2019-10-01 23:45:04 +0200
commitf39fa28f1e671c9896fcaf43abd3886d98ac50ce (patch)
treec847d0c777a3d4ad523036125718a5638118306c
parentc7d8c9cb1231b04c4a1f6c75bf4dcb2d93b43d3b (diff)
downloadcurl-bagder/urlapi-urlencode-absurl.tar.gz
fixup memory-leak in urlapi in error pathbagder/urlapi-urlencode-absurl
-rw-r--r--lib/urlapi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/urlapi.c b/lib/urlapi.c
index 989c0e4e2..b7a527753 100644
--- a/lib/urlapi.c
+++ b/lib/urlapi.c
@@ -873,8 +873,11 @@ static CURLUcode seturl(const char *url, CURLU *u, unsigned int flags)
else if(!(flags & CURLU_PATH_AS_IS)) {
/* sanitise paths and remove ../ and ./ sequences according to RFC3986 */
char *newp = Curl_dedotdotify(path);
- if(!newp)
+ if(!newp) {
+ if(path_alloced)
+ free(path);
return CURLUE_OUT_OF_MEMORY;
+ }
if(strcmp(newp, path)) {
/* if we got a new version */