1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-03-13 12:58:20 +03:00

boot: ReallocatePool() supports NULL pointers as first argument

Just like userspace realloc() the EFIlib ReallocatePool() function is
happy to use a NULL pointer as input, in which case it is equivalent to
AllocatePool(). See:

269ef9dbc7/lib/misc.c (L57)
This commit is contained in:
Lennart Poettering 2021-09-20 14:06:23 +02:00
parent ff3aa8d1e0
commit 04394aa185

View File

@ -912,14 +912,11 @@ static VOID config_add_entry(Config *config, ConfigEntry *entry) {
assert(entry);
if ((config->entry_count & 15) == 0) {
UINTN i;
i = config->entry_count + 16;
if (config->entry_count == 0)
config->entries = AllocatePool(sizeof(VOID *) * i);
else
config->entries = ReallocatePool(config->entries,
sizeof(VOID *) * config->entry_count, sizeof(VOID *) * i);
UINTN i = config->entry_count + 16;
config->entries = ReallocatePool(
config->entries,
sizeof(VOID *) * config->entry_count,
sizeof(VOID *) * i);
}
config->entries[config->entry_count++] = entry;
}