It depend if realloc
was successful or not. If realloc
is successful then:
No ! For example, if there is not enough contiguous memory after
oldline
thennewline
will be different fromoldline
.Yes
free(newline);
sinceoldline
has been freed if necessary. After a reallocoldline
should be considered as invalid pointer.
If it is not successful. Then, you use oldline
as if nothing happened, in particular you should free it.