修复 xy_str_delete_prefix 误释放的问题

This commit is contained in:
Mikachu2333
2025-10-06 03:00:24 +08:00
parent 547931c4e4
commit 5588beb542

View File

@@ -583,12 +583,11 @@ xy_str_delete_prefix (const char *str, const char *prefix)
{
char *new = xy_strdup (str);
bool yes = xy_str_start_with (str, prefix);
if (!yes)
return new;
if (!yes) return new;
size_t len = strlen (prefix);
char *cur = new + len;
return cur;
char *ret = xy_strdup (new + len);
free (new);
return ret;
}
/**