I presumed the work involved in string reallocation would be the same for both approaches and so excluded the substring step for clearer exposition.
But, because I've not had to code pure C in a long time and there is a certain delight in being able to do this stuff, I think it should be:
char* res = malloc(strlen(str)+1);
return res != NULL ? strcpy(res,str) : NULL