When a nvvar is about to be removed then it is set to NULL by barebox. This means for the variable to free it's memory. In this case also do not pass the value to the corresponding globalvar, since that would set the globalvar to NULL aswell, but we want to keep its current value. Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> --- common/globalvar.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/common/globalvar.c b/common/globalvar.c index 77b89c1791..11cf6ce3fe 100644 --- a/common/globalvar.c +++ b/common/globalvar.c @@ -167,8 +167,10 @@ static int nv_set(struct device_d *dev, struct param_d *p, const char *val) { int ret; - if (!val) - val = ""; + if (!val) { + free(p->value); + return 0; + } ret = dev_set_param(&global_device, p->name, val); if (ret) -- 2.11.0 _______________________________________________ barebox mailing list barebox@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox