[PATCH 2/3] parameter: set p->value to NULL to avoid freeing it again

Sascha Hauer s.hauer at pengutronix.de
Mon Jun 14 03:43:43 EDT 2010


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 lib/parameter.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/parameter.c b/lib/parameter.c
index a3d178f..0aa4193 100644
--- a/lib/parameter.c
+++ b/lib/parameter.c
@@ -129,8 +129,10 @@ int dev_param_set_generic(struct device_d *dev, struct param_d *p,
 {
 	if (p->value)
 		free(p->value);
-	if (!val)
+	if (!val) {
+		p->value = NULL;
 		return 0;
+	}
 	p->value = strdup(val);
 	return 0;
 }
-- 
1.7.1




More information about the barebox mailing list