修复 xy_normalize_path 内存泄露

This commit is contained in:
Mikachu2333
2025-10-06 01:56:15 +08:00
parent a3600bf05f
commit 2a9d13bfc8

View File

@@ -1249,13 +1249,14 @@ xy_normalize_path (const char *path)
if (xy_str_start_with (new, "~")) if (xy_str_start_with (new, "~"))
{ {
new = xy_2strcat (xy_os_home, xy_str_delete_prefix (new, "~")); xy_str_swap (&new, xy_2strcat (xy_os_home, xy_str_delete_prefix (new, "~")));
} }
if (xy.on_windows) if (xy.on_windows)
return xy_str_gsub (new, "/", "\\"); {
else xy_str_swap (&new, xy_str_gsub (new, "/", "\\"));
return new; }
return new;
} }