All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peng Fan <van.freenix@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/1] common: env: initialize scalar variable
Date: Tue, 22 Dec 2015 17:14:14 +0800	[thread overview]
Message-ID: <1450775655-2979-2-git-send-email-van.freenix@gmail.com> (raw)
In-Reply-To: <1450775655-2979-1-git-send-email-van.freenix@gmail.com>

From: Peng Fan <peng.fan@nxp.com>

Before calling hsearch_r, initialize callback entry to NULL.

Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
---
 common/env_callback.c | 1 +
 common/env_flags.c    | 1 +
 2 files changed, 2 insertions(+)

diff --git a/common/env_callback.c b/common/env_callback.c
index f4d3dbd..1957cc1 100644
--- a/common/env_callback.c
+++ b/common/env_callback.c
@@ -97,6 +97,7 @@ static int set_callback(const char *name, const char *value, void *priv)
 
 	e.key	= name;
 	e.data	= NULL;
+	e.callback = NULL;
 	hsearch_r(e, FIND, &ep, &env_htab, 0);
 
 	/* does the env variable actually exist? */
diff --git a/common/env_flags.c b/common/env_flags.c
index e682d85..7719355 100644
--- a/common/env_flags.c
+++ b/common/env_flags.c
@@ -455,6 +455,7 @@ static int set_flags(const char *name, const char *value, void *priv)
 
 	e.key	= name;
 	e.data	= NULL;
+	e.callback = NULL;
 	hsearch_r(e, FIND, &ep, &env_htab, 0);
 
 	/* does the env variable actually exist? */
-- 
2.6.2

  reply	other threads:[~2015-12-22  9:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-22  9:14 [U-Boot] [PATCH 1/1] common: cli: avoid memory leak Peng Fan
2015-12-22  9:14 ` Peng Fan [this message]
2015-12-22  9:29   ` [U-Boot] [PATCH 1/1] common: env: initialize scalar variable Wolfgang Denk
2015-12-23  3:07     ` Peng Fan
2015-12-22  9:14 ` [U-Boot] [PATCH 1/1] common: nvedit: use snprintf instead of sprintf Peng Fan
2015-12-22  9:53   ` Fabio Estevam
2015-12-22 19:40     ` Tom Rini
2015-12-23  3:00       ` Peng Fan
2015-12-22 19:11   ` Joe Hershberger
2015-12-28  4:22 ` [U-Boot] [PATCH 1/1] common: cli: avoid memory leak Simon Glass
2015-12-28  5:12   ` Peng Fan
2016-01-04 19:59     ` Tom Rini
2016-01-04 22:23 ` [U-Boot] [U-Boot,1/1] " Tom Rini

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=1450775655-2979-2-git-send-email-van.freenix@gmail.com \
    --to=van.freenix@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.