Fix lingering bug, post incrementing pointers is almost never a good idea.

This commit is contained in:
Joachim Nilsson 2010-07-24 02:46:04 +02:00
parent 5a8ad742d9
commit c7b78df006

View File

@ -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;
} }