mirror of
https://github.com/moparisthebest/curl
synced 2024-12-25 01:28:51 -05:00
smb: fix memory-leak in URL parse error path
Detected by OSS-Fuzz Bug: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9369 Closes #2740
This commit is contained in:
parent
2c33105dbf
commit
5b511b0958
@ -969,11 +969,9 @@ static CURLcode smb_parse_url_path(struct connectdata *conn)
|
|||||||
|
|
||||||
/* Parse the path for the share */
|
/* Parse the path for the share */
|
||||||
req->share = strdup((*path == '/' || *path == '\\') ? path + 1 : path);
|
req->share = strdup((*path == '/' || *path == '\\') ? path + 1 : path);
|
||||||
if(!req->share) {
|
|
||||||
free(path);
|
free(path);
|
||||||
|
if(!req->share)
|
||||||
return CURLE_OUT_OF_MEMORY;
|
return CURLE_OUT_OF_MEMORY;
|
||||||
}
|
|
||||||
|
|
||||||
slash = strchr(req->share, '/');
|
slash = strchr(req->share, '/');
|
||||||
if(!slash)
|
if(!slash)
|
||||||
@ -981,8 +979,7 @@ static CURLcode smb_parse_url_path(struct connectdata *conn)
|
|||||||
|
|
||||||
/* The share must be present */
|
/* The share must be present */
|
||||||
if(!slash) {
|
if(!slash) {
|
||||||
free(path);
|
Curl_safefree(req->share);
|
||||||
|
|
||||||
return CURLE_URL_MALFORMAT;
|
return CURLE_URL_MALFORMAT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -995,8 +992,6 @@ static CURLcode smb_parse_url_path(struct connectdata *conn)
|
|||||||
*slash = '\\';
|
*slash = '\\';
|
||||||
}
|
}
|
||||||
|
|
||||||
free(path);
|
|
||||||
|
|
||||||
return CURLE_OK;
|
return CURLE_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user