diff options
authorSascha Hauer <>2017-11-23 21:47:13 +0100
committerSascha Hauer <>2017-12-01 12:33:33 +0100
commitfa4c41ba60af6e8260307fadcd5fb68f8bdb7360 (patch)
parent3edbc17f1ab1a13b6ddd7fcb4dee596ab41ae0b1 (diff)
nvvar: when setting a nvvar to NULL just free the content
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 <>
1 files changed, 4 insertions, 2 deletions
diff --git a/common/globalvar.c b/common/globalvar.c
index fdfaf76..5fa74a6 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)