X-Git-Url: https://code.delx.au/refind/blobdiff_plain/79ed85b4dee4e6d8bc4068e7b9730acdaa0ff52e..05d641020fe8cea57fa41b9e19459727a463d0c0:/libeg/lodepng.c diff --git a/libeg/lodepng.c b/libeg/lodepng.c index 92bf3a1..99895fe 100644 --- a/libeg/lodepng.c +++ b/libeg/lodepng.c @@ -66,10 +66,18 @@ with the "LODEPNG_COMPILE_" #defines divide this up further in an intermixed way name, so that you can easily change them to others related to your platform in this one location if needed. Everything else in the code calls these.*/ +// EFI's equivalent of realloc requires the original buffer's size as an +// input parameter, which the standard libc realloc does not require. Thus, +// I've modified mymalloc() to allocate more memory to store this data, +// and myrealloc() can then read it when required. Because the size is +// stored at the start of the allocated area, these functions are NOT +// interchangeable with the standard EFI functions; memory allocated via +// mymalloc() should be freed via myfree(), and myfree() should NOT be +// used with memory allocated via AllocatePool() or AllocateZeroPool()! + static void *mymalloc(size_t size) { void *ptr; -// size += sizeof (size_t); ptr = AllocateZeroPool(size + sizeof(size_t)); if (ptr) { *(size_t *) ptr = size;