From: Jan Kiszka <[email protected]>

By using one indirection too much, we overwrote after the first element
pgci with the next element before freeing it. Let's just remove the
additional indirection, it's not needed.

Signed-off-by: Jan Kiszka <[email protected]>
---
 env/env_api.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/env/env_api.c b/env/env_api.c
index 16de319..4fa759d 100644
--- a/env/env_api.c
+++ b/env/env_api.c
@@ -269,22 +269,21 @@ int ebg_env_finalize_update(ebgenv_t *e)
                return EIO;
        }

-       GC_ITEM **pgci, *tmp;
+       GC_ITEM *pgci, *tmp;
        uint8_t *udata;

-       pgci = (GC_ITEM **)&e->gc_registry;
+       pgci = (GC_ITEM *)e->gc_registry;
        udata = ((BGENV *)e->bgenv)->data->userdata;
-       while (*pgci) {
+       while (pgci) {
                uint8_t *var;
-               var = bgenv_find_uservar(udata, (*pgci)->key);
+               var = bgenv_find_uservar(udata, pgci->key);
                if (var) {
                        bgenv_del_uservar(udata, var);
                }
-               free((*pgci)->key);
-               tmp = (*pgci)->next;
-               free(*pgci);
-               *pgci = NULL;
-               pgci = &tmp;
+               free(pgci->key);
+               tmp = pgci->next;
+               free(pgci);
+               pgci = tmp;
        }

        ((BGENV *)e->bgenv)->data->in_progress = 0;
--
2.26.2

-- 
You received this message because you are subscribed to the Google Groups "EFI 
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/efibootguard-dev/844aebb2653d725b1b7d8d502d420cf7fc433f59.1592139558.git.jan.kiszka%40web.de.

Reply via email to