mirror of
https://github.com/troglobit/editline.git
synced 2025-05-06 12:31:45 +08:00
Fix lingering bug, post incrementing pointers is almost never a good idea.
This commit is contained in:
parent
5a8ad742d9
commit
c7b78df006
@ -125,12 +125,11 @@ static int SplitPath(char *path, char **dirpart, char **filepart)
|
|||||||
free(dpart);
|
free(dpart);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
if ((dpart = strdup(path)) == NULL)
|
if ((dpart = strdup(path)) == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
dpart[fpart - path + 1] = '\0';
|
dpart[fpart - path + 1] = '\0';
|
||||||
if ((fpart = strdup(++fpart)) == NULL) {
|
if ((fpart = strdup(fpart + 1)) == NULL) {
|
||||||
free(dpart);
|
free(dpart);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user