diff options
author | Daniel Stenberg <daniel@haxx.se> | 2018-07-12 11:44:57 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2018-07-12 11:44:57 +0200 |
commit | bf706397987faa80708682f74d1db3ebb0887bab (patch) | |
tree | 36bf8f258810c0212519e9448aed6283850daab5 | |
parent | acefdd0cd17443dae59921ae9f1245385e5ad4d0 (diff) | |
download | curl-bagder/smb-memleak-parse-url.tar.gz |
smb: fix memory-leak in URL parse error pathbagder/smb-memleak-parse-url
Detected by OSS-Fuzz
Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9369
-rw-r--r-- | lib/smb.c | 11 |
1 files changed, 3 insertions, 8 deletions
@@ -969,11 +969,9 @@ static CURLcode smb_parse_url_path(struct connectdata *conn) /* Parse the path for the share */ req->share = strdup((*path == '/' || *path == '\\') ? path + 1 : path); - if(!req->share) { - free(path); - + free(path); + if(!req->share) return CURLE_OUT_OF_MEMORY; - } slash = strchr(req->share, '/'); if(!slash) @@ -981,8 +979,7 @@ static CURLcode smb_parse_url_path(struct connectdata *conn) /* The share must be present */ if(!slash) { - free(path); - + Curl_safefree(req->share); return CURLE_URL_MALFORMAT; } @@ -995,8 +992,6 @@ static CURLcode smb_parse_url_path(struct connectdata *conn) *slash = '\\'; } - free(path); - return CURLE_OK; } |