Commit a15a650e05e1a0f5cfabcf61e20ff543df14f5c8

Authored by Peng Fan
Committed by guoyin.chen
1 parent fa76dda1e7

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>
(cherry picked from commit 5a6894397a657edec5d0cf4e20968cc66a368c51)

Showing 2 changed files with 2 additions and 0 deletions Side-by-side Diff

common/env_callback.c
... ... @@ -97,6 +97,7 @@
97 97  
98 98 e.key = name;
99 99 e.data = NULL;
  100 + e.callback = NULL;
100 101 hsearch_r(e, FIND, &ep, &env_htab, 0);
101 102  
102 103 /* does the env variable actually exist? */
... ... @@ -441,6 +441,7 @@
441 441  
442 442 e.key = name;
443 443 e.data = NULL;
  444 + e.callback = NULL;
444 445 hsearch_r(e, FIND, &ep, &env_htab, 0);
445 446  
446 447 /* does the env variable actually exist? */