Replaced realloc() (which is not allowed in kernels, even though malloc() and free are) with my own version of realloc()