Laszlo, this is really cool. Thanks for the analysis and root-cause this.
Best Regards & Thanks, LONG, Qin > -----Original Message----- > From: Laszlo Ersek [mailto:ler...@redhat.com] > Sent: Thursday, February 25, 2016 3:39 AM > To: David Woodhouse; Long, Qin > Cc: Ye, Ting; edk2-de...@ml01.01.org; Bruce Cran > Subject: Re: [edk2] [Patch] CryptoPkg/OpensslLib: Upgrade OpenSSL version > to 1.0.2f > > On 02/24/16 20:30, David Woodhouse wrote: > > 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); > > } > > > > I started composing my other email before yours arrived, and finished and > sent it after yours arrived, it looks like :) > > So yes, this is all. Can I take credit for the analysis, by submitting the > patch? :) > > Thanks > Laszlo _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel