mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: barebox@lists.infradead.org
Subject: [PATCH 2/3] parameter: set p->value to NULL to avoid freeing it again
Date: Mon, 14 Jun 2010 09:43:43 +0200	[thread overview]
Message-ID: <1276501424-3224-3-git-send-email-s.hauer@pengutronix.de> (raw)
In-Reply-To: <1276501424-3224-1-git-send-email-s.hauer@pengutronix.de>

Signed-off-by: Sascha Hauer <s.hauer@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


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2010-06-14  7:43 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-14  7:43 Some (new-) network stack fixes Sascha Hauer
2010-06-14  7:43 ` [PATCH 1/3] tftp: do not forget to close the file in error case Sascha Hauer
2010-06-14  7:43 ` Sascha Hauer [this message]
2010-06-14  7:43 ` [PATCH 3/3] dhcp: do not call net_unregister if net_udp_new failed Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1276501424-3224-3-git-send-email-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox