summaryrefslogtreecommitdiff
path: root/lib/attr.c
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2014-06-24 23:13:37 +0200
committerThomas Haller <thaller@redhat.com>2014-06-25 09:16:49 +0200
commit8e052f59f431844ff6576dcf7b47293ab4ef45aa (patch)
tree39ca68b0ba9e61b1eddc9d2f188951df13e52a9c /lib/attr.c
parent2ca01afceeb224d3a5d6f6a1d0eff741337da05d (diff)
downloadlibnl-8e052f59f431844ff6576dcf7b47293ab4ef45aa.tar.gz
attr: prevent garbage return value for NULL param
If nla is not given, then tmp is not set. Explicitly initalize with 0 to prevent garbage values. Found by Clang static analyzer. Signed-off-by: Peter Wu <peter@lekensteyn.nl> Signed-off-by: Thomas Haller <thaller@redhat.com>
Diffstat (limited to 'lib/attr.c')
-rw-r--r--lib/attr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/attr.c b/lib/attr.c
index 66c029c9..d3de3993 100644
--- a/lib/attr.c
+++ b/lib/attr.c
@@ -648,7 +648,7 @@ int nla_put_u64(struct nl_msg *msg, int attrtype, uint64_t value)
*/
uint64_t nla_get_u64(struct nlattr *nla)
{
- uint64_t tmp;
+ uint64_t tmp = 0;
nla_memcpy(&tmp, nla, sizeof(tmp));