net.urllib: avoid a double free in set_path() when compiled with -autofree (#11427)
parent
79c2bca401
commit
00433ba460
|
@ -622,15 +622,8 @@ fn parse_host(host string) ?string {
|
||||||
// set_path will return an error only if the provided path contains an invalid
|
// set_path will return an error only if the provided path contains an invalid
|
||||||
// escaping.
|
// escaping.
|
||||||
pub fn (mut u URL) set_path(p string) ?bool {
|
pub fn (mut u URL) set_path(p string) ?bool {
|
||||||
path := unescape(p, .encode_path) ?
|
u.path = unescape(p, .encode_path) ?
|
||||||
u.path = path
|
u.raw_path = if p == escape(u.path, .encode_path) { '' } else { p }
|
||||||
escp := escape(path, .encode_path)
|
|
||||||
if p == escp {
|
|
||||||
// Default encoding is fine.
|
|
||||||
u.raw_path = ''
|
|
||||||
} else {
|
|
||||||
u.raw_path = p
|
|
||||||
}
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue