On Wed, 2016-02-24 at 18:20 +0100, Laszlo Ersek wrote: > > Now, in the edk2 build, OPENSSL_free() boils down to a FreePool(). > However, *unlike* the free() function of the standard C library, > FreePool() does *not* handle a NULL argument transparently.
Well that's just utterly batshit insane, now isn't it? I'm amazed that didn't bite us before. If we're providing a free() function especially for OpenSSL because the NIH principle guiding UEFI was *so* strong that we even had to eschew even such *fundamentals* of the C environment, then the least we can do is provide a *correct* one: diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c b/CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c index 544f072..7c7818a 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/BaseMemAllocation.c @@ -38,5 +38,6 @@ void *realloc (void *ptr, size_t size) /* De-allocates or frees a memory block */ void free (void *ptr) { - FreePool (ptr); + if (ptr) + FreePool (ptr); } -- dwmw2
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel