From 692400f446a87112a1c3464e176ac0f3cc29be27 Mon Sep 17 00:00:00 2001 From: Julio Faracco Date: Mon, 8 Apr 2019 17:32:14 -0300 Subject: [PATCH] util: Fix uninitalized variable to avoid garbage This commit fixes an unitialized variable to avoid garbage value when virNetDevBridgeGet method returns error. When, that method fails before initialize 'val' variable, it can cause problems related to that. Signed-off-by: Julio Faracco Reviewed-by: Erik Skultety --- src/util/virnetdevbridge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util/virnetdevbridge.c b/src/util/virnetdevbridge.c index 8d2d8bfc86..0f301d9216 100644 --- a/src/util/virnetdevbridge.c +++ b/src/util/virnetdevbridge.c @@ -760,7 +760,7 @@ int virNetDevBridgeGetSTP(const char *brname, bool *enabled) { int ret = -1; - unsigned long val; + unsigned long val = 0; ret = virNetDevBridgeGet(brname, "stp_state", &val); *enabled = val ? true : false; -- GitLab