Download your own realloc, but note that realloc is a poorly designed functional interface. Just allocate the new buffer with kmalloc and memcpy old data into the new buffer; which is essentially all that realloc does if it cannot expand the buffer in place.
source
share