If the buffer passed lacks sufficient headroom or is a clone then it is copied and the additional headroom made available. If there is no free memory NULL is returned. The new buffer is returned if a copy was made (and the old one dropped a reference). The existing buffer is returned otherwise.
This function primarily exists to avoid making two copies when making a writable copy of a buffer and then growing the headroom.