We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f5d65e3 commit 92a9d42Copy full SHA for 92a9d42
lib/xy.h
@@ -579,12 +579,11 @@ xy_str_delete_prefix (const char *str, const char *prefix)
579
{
580
char *new = xy_strdup (str);
581
bool yes = xy_str_start_with (str, prefix);
582
- if (!yes)
583
- return new;
584
-
+ if (!yes) return new;
585
size_t len = strlen (prefix);
586
- char *cur = new + len;
587
- return cur;
+ char *ret = xy_strdup (new + len);
+ free (new);
+ return ret;
588
}
589
590
/**
0 commit comments