[PATCH] util: Fix uninitalized variable to avoid garbage

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 <jcfaracco@xxxxxxxxx>
---
 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;
-- 
2.19.1

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux