Do the final realloc(3) to the size of the string, not the size of the buffer allocated for the string (which is a noop).