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

[libvirt] [PATCH 3/7] virDomainChrRemove: Initialize @ret

I've seen the following error message during compilation:

conf/domain_conf.c: In function 'virDomainChrRemove':
conf/domain_conf.c:13666:24: error: 'ret' may be used uninitialized in this function [-Werror=maybe-uninitialized]
     virDomainChrDefPtr ret, **arrPtr = NULL;
Compiler fails to see that @ret is used only if set in the loop,
but whatever, there's no harm in initializing the variable.

Signed-off-by: Michal Privoznik <mprivozn redhat com>
 src/conf/domain_conf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 8bfe895..39cedbd 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -13663,7 +13663,7 @@ virDomainChrDefPtr
 virDomainChrRemove(virDomainDefPtr vmdef,
                    virDomainChrDefPtr chr)
-    virDomainChrDefPtr ret, **arrPtr = NULL;
+    virDomainChrDefPtr ret = NULL, **arrPtr = NULL;
     size_t i, *cntPtr = NULL;
     virDomainChrGetDomainPtrsInternal(vmdef, chr->deviceType, &arrPtr, &cntPtr);

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