X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=discover%2Fgrub2%2Fscript.c;h=2aaf1d3d2cb1495a63c48fe7d31f72882d921b52;hb=089d0a6eb769d531129a7cd1061493a1a24b4bef;hp=75b8aaaae474fc6348215dea26d7e963f31e4562;hpb=57293e2111fcba58a7b399cb1332012414bffeeb;p=petitboot diff --git a/discover/grub2/script.c b/discover/grub2/script.c index 75b8aaa..2aaf1d3 100644 --- a/discover/grub2/script.c +++ b/discover/grub2/script.c @@ -23,8 +23,8 @@ container_of(stmt, struct grub2_statement_conditional, st) struct env_entry { - const char *name; - const char *value; + char *name; + char *value; struct list_item list; }; @@ -75,11 +75,13 @@ void script_env_set(struct grub2_script *script, if (!entry) { entry = talloc(script, struct env_entry); - entry->name = name; + entry->name = talloc_strdup(entry, name); list_add(&script->environment, &entry->list); + } else { + talloc_free(entry->value); } - entry->value = value; + entry->value = talloc_strdup(entry, value); } static bool expand_var(struct grub2_script *script, struct grub2_word *word)