3 ms·
> What would the alternative be here? Allocate a new region, copy everything over and free the other region? Or is there something better? No. If realloc fail
by daurnimator 10y ago
> What would the alternative be here? Allocate a new region, copy everything over and free the other region? Or is there something better?
No.
If realloc fails it returns NULL. In which case the original `x` is still valid. ==> However with `x = realloc(x,...)` you don't don't have a reference to `x` any more!