Among the C language's most familiar function rankings, malloc and free must be among the top, while realloc may be back. But you know, with the realloc function, you can even use it instead of malloc or free.
The function is prototype as follows:
Void * realloc (void * PTR, size_t size );
Its job is to re-allocate the memory block pointed to by the PTR parameter when the capacity is insufficient, and ensure that the content remains unchanged.
However, the function specification indicates that the PTR parameter can be null. In this case, realloc is equivalent to malloc. In addition, when the PTR parameter is not null but the size parameter is 0, it is equivalent to free.
If you are doing something similar to 64kbProgramIn this competition, I am racking my brains to save every byte. I don't want to add more import functions in the IAT of the image, so I can try my best. How about it?