common: env: initialize scalar variable

Before calling hsearch_r, initialize callback entry to NULL.

Coverity log:
"
Uninitialized scalar variable (UNINIT)
uninit_use_in_call: Using uninitialized value e.
Field e.callback is uninitialized when calling hsearch_r.
"

Reported-by: Coverity
Signed-off-by: Peng Fan <peng.fan@nxp.com>
Cc: Tom Rini <trini@konsulko.com>
Cc: Simon Glass <sjg@chromium.org>
This commit is contained in:
Peng Fan 2015-12-23 12:07:24 +08:00 committed by Tom Rini
parent 09a788624d
commit 5a6894397a
2 changed files with 2 additions and 0 deletions

View File

@ -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? */

View File

@ -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? */