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 <jcfaracco@gmail.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
This commit is contained in:
Julio Faracco 2019-04-08 17:32:14 -03:00 committed by Erik Skultety
parent f66f70acbe
commit 692400f446

View File

@ -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;