1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 10:51:20 +03:00

efi: explicity check for NULL in FreePoolp()

Firmware implementations are generally pretty bad, hence let's better
add an explicit check for NULL before invokin FreePool(), in particular
is it doesn't appear to be documented whether FreePool() is supposed to
be happy with NULL.
This commit is contained in:
Lennart Poettering 2018-06-21 18:48:21 +02:00
parent 3aaa95e0a0
commit 2880e665ab

View File

@ -33,7 +33,12 @@ CHAR16 *stra_to_str(CHAR8 *stra);
EFI_STATUS file_read(EFI_FILE_HANDLE dir, CHAR16 *name, UINTN off, UINTN size, CHAR8 **content, UINTN *content_size);
static inline void FreePoolp(void *p) {
FreePool(*(void**) p);
void *q = *(void**) p;
if (!q)
return;
FreePool(q);
}
#define _cleanup_(x) __attribute__((cleanup(x)))